-
Notifications
You must be signed in to change notification settings - Fork 275
Use local SDK in global.json #5671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -24,6 +24,7 @@ | |||
}, | |||
"sdk": { | |||
"version": "10.0.100-preview.5.25269.23", | |||
"paths": [ ".dotnet", "$host$" ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing the following in CI:
2025-05-30T07:58:27.6583168Z D:\a\_work\1\s\artifacts\bin\MSTest.Acceptance.IntegrationTests\Release\net10.0\MSTest.Acceptance.IntegrationTests.exe (net10.0|) failed (0ms)
2025-05-30T07:58:27.6588369Z Exit code: -2147450730
2025-05-30T07:58:27.6589476Z Error output: You must install or update .NET to run this application.
2025-05-30T07:58:27.6590320Z App: D:\a\_work\1\s\artifacts\bin\MSTest.Acceptance.IntegrationTests\Release\net10.0\MSTest.Acceptance.IntegrationTests.exe
2025-05-30T07:58:27.6590869Z Architecture: x64
2025-05-30T07:58:27.6591348Z Framework: 'Microsoft.NETCore.App', version '10.0.0-preview.5.25265.101' (x64)
2025-05-30T07:58:27.6591829Z .NET location: C:\Program Files\dotnet\
2025-05-30T07:58:27.6592256Z The following frameworks were found:
2025-05-30T07:58:27.6593235Z 6.0.36 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2025-05-30T07:58:27.6593725Z 6.0.37 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2025-05-30T07:58:27.6594218Z 8.0.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2025-05-30T07:58:27.6594690Z 9.0.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2025-05-30T07:58:27.6595105Z Learn more:
2025-05-30T07:58:27.6595531Z https://aka.ms/dotnet/app-launch-failed
2025-05-30T07:58:27.6595993Z To install missing framework, download:
2025-05-30T07:5
10000
8:27.6596537Z https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=10.0.0-preview.5.25265.101&arch=x64&rid=win-x64&os=win10
This is kinda unexpected for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running locally:
dotnet --list-sdks
: Recognizes the SDK from global.jsondotnet --list-runtimes
: Doesn't recognize runtimes from the locally installed SDK.dotnet/dotnet.exe --list-runtimes
: Recognizes runtimes from the locally installed SDK
Not sure if this is by-design or if there is something missing with the local SDK feature, and if it's by-design, how can we improve the experience there for dotnet test
at least (if we should do anything at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would start from corehost_trace=1
to understand what is happening. Typically I see dotnet_root set to define where the local dotnets are, dotnet_multilevel_lookup set to 0 to prevent going to global dotnet installation (program files), and then also .dotnet.dotnet.exe being added to PATH to ensure we resolve the local dotnet exe for SDK builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing is interesting in the trace logs it seems :(
Using dotnet root path [C:\Program Files\dotnet]
It's not considering the local SDK at all. I'm not sure if that's intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dotnet/designs/blob/main/accepted/2025/local-sdk-global-json.md#dotnet-exec:
This proposal only impacts how .NET SDK commands do runtime discovery. The command dotnet exec is not an .NET SDK command but instead a way to invoke the app directly using the runtime installed with dotnet.
It is reasonable for complex builds to build and use small tools. For example building a tool for linting the build, running complex validation, etc ... To work with local SDK discovery these builds need to leverage dotnet run to execute such tools instead of dotnet exec.
Looks like probably by-design? 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, by design. This is an SDK feature, not a runtime feature. If you run “app.exe” it will not look for a global.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, from user point of view, they are invoking dotnet test
, so it's SDK. But as SDK currently simply runs the test executable directly, we hit this issue (in simple words, we are moving from SDK-world to runtime but losing the info about runtimes installed in the local SDK).
So I guess there might be something to do for the implementation of dotnet test
in that regard? What exactly should we do for dotnet test
?
Uses .NET 10's local SDK.
Spec: https://github.com/dotnet/designs/blob/main/accepted/2025/local-sdk-global-json.md (permalink: https://github.com/dotnet/designs/blob/238ca0202ea5df96d378a06c01960fc289aba166/accepted/2025/local-sdk-global-json.md)