Solid1
Solid1

Reputation: 853

How to fix "No .NET SDKs were found." error--VSCode

I'm trying to setup a backend on my local computer I have installed the v6 dotnet everything is installed but when i run dotnet run I get this error

The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application 'run' does not exist.
  * You intended to execute a .NET SDK command:
      No .NET SDKs were found.

Download a .NET SDK:
https://aka.ms/dotnet-download

Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found

dotnet --info

PS C:\Users\Az\bazaar-online\Server\Src\BazaarOnline.API> dotnet --info

global.json file:
  Not found

Host:
  Version:      6.0.7
  Architecture: x86
  Commit:       0ec02c8c96

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.7 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.7 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]

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

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

I searched a lot but i didn't find anything useful. reinstalled everything tried v3 but didn't fix anything

I have installed these files.

dotnet-hosting-6.0.7-win
dotnet-runtime-6.0.7-win-x64
dotnet-sdk-6.0.302-win-x64

Upvotes: 20

Views: 73464

Answers (6)

Ghostbird
Ghostbird

Reputation: 31

In my case (not Visual‌ Studio Code specific) it was caused by /usr/share/dotnet being in 700 mode (rwx------). sudo chmod -R a+X /usr/share/dotnet fixed it. Reinstall did not fix it, since that directory was not removed by the uninstall script, nor were its permissions modified by the install script.

Upvotes: 0

Jeffrey
Jeffrey

Reputation: 71

The most voted solution works but is not elegant.

I believe you have installed two versions of dotnet: one for x86 and one for x64, and it resolves the x86 version while the SDK is in x64.

That's why you delete everything in x86 works. Instead, you can adjust the order of the path variable to make the system resolve the x64 version first.

Refer to https://learn.microsoft.com/en-us/dotnet/core/install/windows?tabs=net80#no-net-sdk-was-found for the details.

Upvotes: 7

Darrell Brogdon
Darrell Brogdon

Reputation: 6973

Restarting VS Code fixed this for me.

Upvotes: 0

monadwhat
monadwhat

Reputation: 99

I just had this same issue when I wanted to install a new template dotnet new -i "Falco.Template::*". Simply reinstalling the dotnet 6 SDK solved it for me.

Upvotes: 0

laiju john
laiju john

Reputation: 19

The command could not be loaded, possibly because:

  • You intended to execute a .NET application: The application 'myapp.dll' does not exist.
  • You intended to execute a .NET SDK command: No .NET SDKs were found.

Download a .NET SDK: https://aka.ms/dotnet-download

Learn about SDK resolution: https://aka.ms/dotnet/sdk-not-found use this commands 1.sudo apt remove dotnet* 2.sudo apt remove aspnetcore* 3.sudo rm /etc/apt/sources.list.d/microsoft-prod.list 4.sudo apt update 5.sudo apt install dotnet-sdk-6.0

Upvotes: 1

Solid1
Solid1

Reputation: 853

Ok This fixed the problem for me

I went to the C:\Program Files (x86)\dotnet

and deleted everthing in the folder

and than vscode recognized the dotnet sdk.

Upvotes: 43

Related Questions