This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use msbuild /restore instead of a separate process #7896
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We were taking care to set the console verbosity to minimal, but only when no verbosity argument is passed. However, the default verbosity for all CLI msbuild commands is already minimal and so we can just get out of the way.
livarcocc
approved these changes
Oct 24, 2017
nguerrera
force-pushed
the
one-process-restore
branch
5 times, most recently
from
October 26, 2017 20:44
2a964a4
to
9f8a03f
Compare
It is not currently possible when there is a -f|--framework argument because we cannot force a TargetFramework global property on to the restore evaluation. Doing so completely breaks restore by applying the TargetFramework to all projects transitively. The correct behavior is to restore for all frameworks, then build/publish/etc for the given target framework. Achieving that still requires two distinct msbuild invocations. This also changes the verbosity of implicit restore from quiet to that of the subsequent command (default=minimal). Similar to global properties, we cannot specify a distinct console verbosity for the /restore portion of the overall execution. For consistency, we apply the same verbosity change to the case where we still use two separate msbuild invocations. This also fixes an issue where the separate restore invocation's msbuild log would be overwritten by the subsequent command execution. However, this remains unfixed in the case where we still use two separate msbuild invocations.
nguerrera
force-pushed
the
one-process-restore
branch
from
October 26, 2017 23:02
9f8a03f
to
35b7ad2
Compare
@livarcocc Can you take another look? I changed it quite a bit since your review. |
nguerrera
changed the title
WIP One process restore
Use msbuild /restore instead of a separate process
Oct 27, 2017
livarcocc
reviewed
Oct 27, 2017
@@ -37,6 +37,8 @@ public static BuildCommand FromArgs(string[] args, string msbuildPath = null) | |||
|
|||
var appliedBuildOptions = result["dotnet"]["build"]; | |||
|
|||
msbuildArgs.Add($"/clp:Summary"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
livarcocc
approved these changes
Oct 27, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use msbuild /restore instead of separate invocations where possible
Fix #7696
This saves 300ms on my machine for incremental build of a simple console app (from 1.4s to 1.1s).
We still have to miss out on this optimization when there is -f|--framework argument because we cannot force a TargetFramework global property on to the restore evaluation. Doing so completely breaks restore by applying the TargetFramework to all projects transitively. The correct behavior is to restore for all frameworks, then build/publish/etc for the given target framework. Achieving that still requires two distinct msbuild process invocations.
This also changes the verbosity of implicit restore from quiet to that of the subsequent command (default=minimal). Similar to global properties, we cannot specify a distinct console verbosity for the /restore portion of the overall execution. For consistency, we apply the same verbosity change to the case where we still use two separate msbuild invocations.
Output Before:
Output After:
In the incremental no-op restore case, only the line about "Restore completed in X for Y" is added.
NuGet/Home#4695 tracks reducing restores output when verbosity is minimal.
This also fixes an issue where the separate restore invocation's msbuild log would be overwritten by the subsequent command execution. However, this remains unfixed in the case where we still use two separate msbuild invocations.
The first two commits are strictly separate, but were getting in the way of test changes I needed to make so I tackled them here.