Visual Studio – no .NET SDKs were found

When trying to change a VS project to implement some new Azure function need by our Business Central implementation of certain feature Visual Studio was unable to detect dotnet SDKs although multiple versions were installed.

So running

dotnet --info

has given me the following output:

So I have tried running Visual Studio repair multiple times. Installed dotnet SDK for that exact version of Visual Studio 2020 CE. Checking PATH environment variables multiple times. Restarting machine multiple times to no avail.

Solution

However, the solution was right into my nose but… failing to see the obvious. I have suspected that it has something to do with both x86 and x64 versions of .NET installed but could not figured it out what is the difference.

Solution was quite easy. Running

where.exe dotnet

will give you the result of order in which paths of dotnet search is executed.

 If you’re on a x64 machine, you want to have C:\Program Files\dotnet listed first.

Now this is the output of the dotnet –info command: