arcade: Building project in nuget cache breaks global.json search by msbuild sdk resolver
Repro steps
git clone git@github.com:aspnet/AspNetCore.git anothergit checkout bcc962a182a273cdaa7de474528e97913373a212(current master using 5.0 SDK)cd another.\restore.cmdgit checkout 87a110aea8a2ba979de63a354b74e8bdeb8b280e(current release/3.1 using 3.1 SDK).\restore.cmd
Expected result
Both restores succeed
Actual result
Second restore fails because it is trying to use 5.0 SDK that does not support targeting 3.1 (yet)
D:\Src\another\.dotnet\sdk\5.0.100-alpha1-014696\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(262,5): error NETSDK1073: The FrameworkReference 'Microsoft.NETCore.App' was not recognized [D:\Src\another\eng\tools\RepoTasks\RepoTasks.csproj]
This happens because arcade builds a project file in the nuget cache and not the repo, so the search for global.json starts in the wrong place, and the global.json specifying 3.1 SDK is not respected.
Tracing enabled @ Thu Oct 10 22:54:53 2019 GMT
--- Invoked hostfxr_resolve_sdk2 [commit hash: dfb28413477684834589b8b23492b48c43726e10]
Probing path [C:\Users\nicholg\.nuget\packages\microsoft.dotnet.arcade.sdk\1.0.0-beta.19462.4\tools\global.json] for global.json
Probing path [C:\Users\nicholg\.nuget\packages\microsoft.dotnet.arcade.sdk\1.0.0-beta.19462.4\global.json] for global.json
Probing path [C:\Users\nicholg\.nuget\packages\microsoft.dotnet.arcade.sdk\global.json] for global.json
Probing path [C:\Users\nicholg\.nuget\packages\global.json] for global.json
Probing path [C:\Users\nicholg\.nuget\global.json] for global.json
Probing path [C:\Users\nicholg\global.json] for global.json
Probing path [C:\Users\global.json] for global.json
Probing path [C:\global.json] for global.json
Terminating global.json search at [C:\]
Resolving SDKs with version = 'latest', rollForward = 'latestMajor', allowPrerelease = true
Searching for SDK versions in [D:\Src\another\.dotnet\sdk]
Version [3.1.100-preview1-014400] is a better match than [none]
Version [5.0.100-alpha1-014696] is a better match than [3.1.100-preview1-014400]
SDK path resolved to [D:\Src\another\.dotnet\sdk\5.0.100-alpha1-014696]
I think the build.proj tools.proj should be moved to eng\common or it should not import any SDKs.
cc @dougbu
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (16 by maintainers)
@nguerrera It’s in 5.0 right now. https://github.com/dotnet/corefx/pull/41832 would need to be ported to 3.x if we were to port it.
@markwilkie