AlpakaJoe
AlpakaJoe

Reputation: 593

VSCode .NET Core SDK cannot be located

I'm using Ubuntu 20.04 (64 bit, desktop) and just installed VS Code and .NET Core SDK.

Intellisense does not work and I get that error message:

The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path.

I reinstalled the .NET Core SDK (from the SnapStore) and made sure that VS Code is not open while installing it.

After that I could use intellisense for about 5 seconds, then the error appeared again and intellisense stopped working.

EDIT: When using the scripted intall as "Ben" mentioned, i get this result:

dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where: dotnet-install: - The SDK needs to be installed without user interaction and without admin rights. dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs. dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: .NET Core SDK version 3.1.409 is already installed. dotnet-install: Adding to current process PATH: /home/MYUSERNAME/.dotnet. Note: This change will be visible only when sourcing script. dotnet-install: Note that the script does not resolve dependencies during installation. dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section. dotnet-install: Installation finished successfully.

Upvotes: 4

Views: 12424

Answers (4)

Dennis Kabugua
Dennis Kabugua

Reputation: 65

im using ubuntu Ubuntu 22.04.2 run dotnet --list-sdks to see where your sdks are installed. In my case i got the foolowing output

path to dotnet sdk

go to file, preferences, settings in visual studio code, search for onmisharp dotnet path update update Dot Net Cli Paths and dotnet path using the paths where your sdk is istalled

Upvotes: 0

Abdulkerim Jemal
Abdulkerim Jemal

Reputation: 67

sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/dotnet 

worked for me from this answer: https://stackoverflow.com/a/66429089/16969349

Upvotes: 3

Ben
Ben

Reputation: 404

I wouldn't use the .NET SDK from snap, since snap "apps" run in a containerized environment, which makes it much harder for other apps to be able to find them. Have you tried installing using Microsoft's guide? I would recommend using the scripted install

Upvotes: 0

Kashyap
Kashyap

Reputation: 66

I had the same problem what I did is

  1. uninstall all of the services that belong to Visual Studio(not Vs Code)
  2. uninstall VS Code and folder "AppData\Local\Programs\Microsoft VS Code
  3. download new dotnet core SDK and install vs code.

Upvotes: -3

Related Questions