msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

BuildCheck does not run on restore

Open maridematte opened this issue 4 months ago • 0 comments

Fixes: https://github.com/dotnet/msbuild/issues/9747

Context

We currently run BuildCheck during the restore phase of the build, because of this we end up running BuildCheck twice per project. This PR disables BuildCheck during restore phase.

Changes Made

Added two check for the restore phase on the code.

The first one is on the RequestBuilder, it reads the global property IsRestore and creates a BuildCheck instance as necessary.

The second one is within the BuildCheckConnectorLogger so we do not start a new BuildCheck run because of received events. In this case I added a bool to ProjectEvaluationStartedEventArgs so we can have access to the IsRestore variable within the logger. We skip all event messages until we get a ProjectFinishedEventArgs, which signals the end of a build / the restore phase.

Tests

Added extra tests that only runs the restore target.

Reopened from https://github.com/dotnet/msbuild/pull/9907

maridematte avatar Apr 16 '24 16:04 maridematte