Skip to content
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

.NET SDK installed but vscode can't find it #1756

Open
SoggyWelshCakes opened this issue Feb 9, 2025 · 2 comments
Open

.NET SDK installed but vscode can't find it #1756

SoggyWelshCakes opened this issue Feb 9, 2025 · 2 comments

Comments

@SoggyWelshCakes
Copy link

.Net SDK is installed and works as intended through terminal commands.
Attempting to run/debug a project in vscode yields this error:

You must install .NET to run this application.

App: /home/soggywelshcakes/.../bin/Debug/net9.0/projectname
Architecture: x64
App host version: 9.0.1
.NET location: Not found

Learn more:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=linux-x64&os=linuxmint.22&apphost_version=9.0.1

Press any key to continue...

I have tried telling vscode where dotnet is in settings.json as suggested in a couple of issues I've seen:

{
    "dotnetAcquisitionExtension.existingDotnetPath": [
        {
            "extensionId": "ms-dotnettools.vscode-dotnet-runtime",
            "path": "/usr/shared/dotnet/dotnet"
        },
        {
            "extensionId": "ms-dotnettools.csharp",
            "path": "/usr/shared/dotnet/dotnet"
        }
    ]
}

I'm not exactly sure what path I should be putting here, the settings says to point to the "dotnet.exe" but I don't have that. I've tried different paths like ".../dotnet/sdk/9.0.102/" but so far nothing has worked.
Vscode usually says:

The 'existingDotnetPath' setting was set, but it did not meet the requirements for this extension to run properly. This setting has been ignored. If you would like to continue to use the setting anyways, set dotnetAcquisitionExtension.allowInvalidPaths to true in the .NET Install Tool Extension Settings. Extension: ms-dotnettools.csharp

and enabling the suggested setting causes more issues.

On my laptop however, C# has worked mostly flawlessly and has these settings in settings.json:

{
    "dotnetAcquisitionExtension.sharedExistingDotnetPath": "/home/soggywelshcakes/Downloads/net/sdk/8.0.403"
}

I don't remember what exactly I did to cause this, I didn't even know dotnet was just hiding in Downloads, but strangely enough removing this line causes this issue when I try to debug a program:

Unable to provide debug configurations: LaunchableProjectInfoObserver has not been subscribed to an ILaunchConfigurationService.

and

Configuration 'C#: ProjectName' is missing in 'launch.json'.

Unfortunately, undoing the change did not restore my laptop's vscode and not I get the same error above ("Unable to provide debug configurations: ...") along with the "The 'existingDotnetPath' setting was set, but did not meet the requirements ..." error previously mentioned. I also get:

Failed to restore NuGet packages for the solution.

So many errors please help!

Environments

Main Computer

Running dotnet --info yields:

.NET SDK:
 Version:           9.0.102
 Commit:            cb83cd4923
 Workload version:  9.0.100-manifests.43af17c7
 MSBuild version:   17.12.18+ed8c6aec5

Runtime Environment:
 OS Name:     linuxmint
 OS Version:  22
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/9.0.102/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.1
  Architecture: x64
  Commit:       c8acea2262

.NET SDKs installed:
  8.0.405 [/usr/share/dotnet/sdk]
  9.0.102 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Laptop

Running dotnet --info yields:

.NET SDK:
 Version:           9.0.101
 Commit:            eedb237549
 Workload version:  9.0.100-manifests.3068a692
 MSBuild version:   17.12.12+1cce77968

Runtime Environment:
 OS Name:     linuxmint
 OS Version:  21.3
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/9.0.101/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0
  Architecture: x64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  9.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@erikbrntsn
Copy link

I have the same problem. Also using dotnet 9.0.102

@gnomeby
Copy link

gnomeby commented Feb 13, 2025

export DOTNET_ROOT=/opt/dotnet-sdk-bin-9.0 solved the problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants