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.
My home box has both the 7.0.400 and 8.0.100 RC2 .NET SDKs installed. This ended up revealing a subtle bug in the CLI when executing
dotnet test
.The test content in this repo generates a global.json that pins the SDK to 7.0.400. That is done for consistency in testing across developer machines and CI. The repository itself has no global.json file so it floats to the latest .NET SDK.
This combination revealed an odd bug in MSBuild. When executing
dotnet test
the CLI ended up spawning adotnet
that sets the%MSBuildSDKsPath%
environment variable. Becausedotnet
spawned as an 8.0 process it set that path to the 8.0 SDK.When executing the
dotnet new
actions inside the tests the global.json was read by the runtime host and ended up spawning adotnet
process from the 7.0 runtime. But msbuild ended up loading tasks / targets from 8.0 SDK due to the%MSBuildSDKsPath%
value. Those targetednet8.0
and hence failed to load in the 7.0 runtime.
Thanks to @rainersigwald and @baronfel for tracking this down!
dotnet/msbuild#9411
variable