Exclude runtime assets from Microsoft.Build package to fix flakey tests #4751
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.
Bug
Fixes: https://github.com/NuGet/Client.Engineering/issues/1813
Regression? Last working version:
Description
MSBuild does not support runtime scenarios where the
Microsoft.BuildDLL is placed in an output directory.See https://docs.microsoft.com/en-us/visualstudio/msbuild/updating-an-existing-application?view=vs-2022#use-nuget-packages-preferred
The symptom of this is that depending on where MSBuild resolves its runtime assets on a given machine, it may utilize the DLL in our Test project's output directory. When this happens, certain tests fail because our MSBuild utilities attempt to load project files by
Activator.CreateInstance. When Version 4.x of MSBuild is loaded (likely in the GAC), it expects aToolsVersion, but does not support theCurrentvalue which is used by latest MSBuild versions.NuGet.Client/src/NuGet.Clients/NuGet.CommandLine/Common/MSBuildProjectSystem.cs
Line 448 in c398135
An example of an error that goes away with this change is:
PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Documentation