Building project in nuget cache breaks global.json search by msbuild sdk resolver
See original GitHub issueRepro steps
git clone git@github.com:aspnet/AspNetCore.git another
git checkout bcc962a182a273cdaa7de474528e97913373a212
(current master using 5.0 SDK)cd another
.\restore.cmd
git 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
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
Assets file project.assets.json not found. Run a NuGet ...
The error occurs because the dotnet cli does not create the all of the required files initially. Doing dotnet restore adds the required...
Read more >Nuget restore fails because .NET Core SDK cannot be ...
I don't have a global.json so there is nothing to check. I now added the environment variable to the config like so: variables:...
Read more >Troubleshooting NuGet Package Restore in Visual Studio
This article focuses on common errors when restoring packages and steps to resolve them. Package Restore tries to install all package ...
Read more >MSB3277: Found conflicts between different versions of ' ...
This error occurs during a build when more than one version of the same dependent assembly is referenced in a build of the...
Read more >Matt Ward
NuGet restore has been improved for a solution contains a mix of classic (non SDK style projects) and SDK style projects. Problems can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
I see what you mean. IDK.