Description
Environment data
dotnet --info output:
Version: 6.0.428
Commit: 9e8b7c8d8e
Runtime Environment:
OS Name: macOS
OS Version: 12.6
OS Platform: Darwin
RID: osx.12-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.428/
Host (useful for support):
Version: 6.0.36
Commit: 5b5c3c0c8e
.NET SDKs installed:
6.0.428 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
VS Code version: 1.78.0
C# Extension version: 2.72.27
C# logs
C# output window contents:
2025-04-08 08:48:52.137 [info] Locating .NET runtime version 9.0.1
2025-04-08 08:48:52.437 [info] Dotnet path: /usr/local/share/dotnet/dotnet
2025-04-08 08:48:52.437 [info] Activating C# standalone...
2025-04-08 08:48:52.452 [error] [stderr] You must install or update .NET to run this application.
App: /Users/amanda.mata/.vscode/extensions/ms-dotnettools.csharp-2.72.27-darwin-x64/.roslyn/Microsoft.CodeAnalysis.LanguageServer.dll
Architecture: x64
2025-04-08 08:48:52.452 [error] [stderr] Framework: 'Microsoft.NETCore.App', version '9.0.0' (x64)
.NET location: /usr/local/share/dotnet/
The following frameworks were found:
6.0.36 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=9.0.0&arch=x64&rid=osx.15-x64
2025-04-08 08:48:52.453 [info] Language server process exited with 150
2025-04-08 08:48:52.464 [info] [Error - 8:48:52 AM] Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server.
2025-04-08 08:48:52.464 [info] Error: Language server process exited unexpectedly
at ChildProcess.<anonymous> (/Users/amanda.mata/.vscode/extensions/ms-dotnettools.csharp-2.72.27-darwin-x64/dist/extension.js:1227:20302)
at ChildProcess.emit (node:events:530:35)
at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
Steps to reproduce
Open Visual Studio Code.
Install the C# extension (version 2.72.27).
Open a project targeting .NET 6.
Observe the error in the C# output window.
Expected behavior
The C# extension should use the installed .NET 6 runtime (6.0.36) to run the language server and work correctly with projects targeting .NET 6.
Actual behavior
The C# extension attempts to use the .NET 9 runtime (Microsoft.NETCore.App 9.0.0), which is not installed. This causes the language server to fail with the following error:
You must install or update .NET to run this application.
Additional context
The project is explicitly targeting .NET 6, and the runtime 6.0.36 is installed and available.
A global.json file is present in the project root, specifying the SDK version 6.0.428.
The issue persists even after disabling OmniSharp: Use Modern Net in the extension settings.