16

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
Ray
  • 12,101
  • 27
  • 95
  • 137
  • What does `dotnet --info` show you? The issue can be related to architecture, see here: https://github.com/dotnet/runtime/issues/3242 – mxmissile Jan 12 '21 at 22:01
  • @mxmissile thank you for the tip, I just updated my question with the result from doing `dotnet --info`, please see above. – Ray Jan 12 '21 at 22:15

5 Answers5

20

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

Pavel Zika
  • 221
  • 1
  • 5
  • This worked for me, there were two installations of dotnet on my harddrive and both visual studio and cmd were finding the wrong one. – baddie Sep 05 '21 at 23:41
16

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.

omajid
  • 14,165
  • 4
  • 47
  • 64
  • Thank you for your input, I ended up re-installing VS2019 to get around this issue. – Ray Jan 13 '21 at 01:08
  • Worked for me - both .\program files (x86)\dotnet and .\program files\dotnet were in my path. removing the x86 version from the path worked! now visual studio 2019 will load my project – TamusJRoyce Oct 29 '21 at 12:57
8

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.

ThisWholeDev
  • 889
  • 8
  • 8
1

See Windows or Visual Studio can't find the latest installed .NET SDK

If the first SDK installed on the machine is a different bit size, you won't see the latest SDK

RickAndMSFT
  • 20,912
  • 8
  • 60
  • 78
0

You can use sdk check command. E.g.

dotnet sdk check

Output will be similar to below image, but will depend upon what sdk you have installed.

enter image description here

WitVault
  • 23,445
  • 19
  • 103
  • 133