Why dotnet --list-sdks does not show installed SDKs on Windows 10?

Viewed 4103

I have Microsoft .NET SDK 5.0.102 (x64) installed on my Windows 10, but when I do dotnet --list-sdks nothing shows up? I could see the SDK installed from Windows Apps & features. Thank you.

Edit:

Doing dotnet --info shows the following

$ dotnet --info

Host (useful for support):
  Version: 5.0.2
  Commit:  cb5f173b96

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.9 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.11 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.9 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.11 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.1 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.1 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
4 Answers

Removing c:\Program Files (x86)\dotnet\dotnet.exe from global System Variables Path helps for me.

There are multiple .NET installations on your system and they are getting mixed up.

You have one installation that's x86 (C:\Program Files (x86)) - and has no SDK - and another that's x64 - and has the 5.0.102 SDK.

When you run dotnet, you seem to be running the x86 version.

The SDK you have installed is the x64 version.

You should try and figure out which architecture you need and uninstall the other one.

CHECK YOUR ENVIRONMENT VARIABLES!

I just ran into this issue and discovered that some how my C:\Program Files (x86)\dotnet\ environment variable was above my C:\Program Files\dotnet\ which meant that whenever I ran the dotnet command it was using the x86 version.

Related