question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building project in nuget cache breaks global.json search by msbuild sdk resolver

See original GitHub issue

Repro steps

  1. git clone git@github.com:aspnet/AspNetCore.git another
  2. git checkout bcc962a182a273cdaa7de474528e97913373a212 (current master using 5.0 SDK)
  3. cd another
  4. .\restore.cmd
  5. git checkout 87a110aea8a2ba979de63a354b74e8bdeb8b280e (current release/3.1 using 3.1 SDK)
  6. .\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:closed
  • Created 4 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
tmatcommented, Oct 17, 2019

@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

0reactions
tmatcommented, Oct 17, 2019

I see what you mean. IDK.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found