MSBuild NuGet SDK Resolver fails to locate global.json file in Visual Studio project folder #11747
Labels
Functionality:Restore
Product:MSBuildSDKResolver
The NuGet powered SDK resolver. Owned by MSBuild team
Resolution:ByDesign
This issue appears to be ByDesign
Type:Bug
Milestone
NuGet Product Used
dotnet.exe, MSBuild.exe
Product Version
Visual Studio 2022 17.2 Preview 3
Worked before?
Visual Studio 2022 17.1 and earlier
Impact
It's more difficult to complete my work
Repro Steps & Context
The issue is a dotnet CLI template which contains a global.json file (in my case referencing a project SDK) which is then also used via the Visual Studio new project dialog. So the global.json file is in the same directory as the project, but in the Visual Studio case the default creation case is to create a solution folder and a project sub-folder. The project sub-folder contains the global.json file in this case. The MSBuild NuGet SDK Resolver fails to locate the global.json file in the project folder.
The issue was trigger by this #4380 I believe. There was a subsequent bug and a change with this #4507.
That secondary change almost fixes the issue for me, but unfortunately it does not handle the case when the resolver context defines both a solution and project. The existing code means the solution always wins even if the project is set. The consequence is that a global.json in the project folder is not found. I believe a change to check the project file path context first would resolve this problem.
Verbose Logs
No response
The text was updated successfully, but these errors were encountered: