'Microsoft Visual Studio 2019: Unable to locate .NET Core SDK

When I try to create an Azure Timer Function in a Function App in Visual Studio Code 2019, I get the following error:

Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version

However, when I look in my installed programs, it does show that the .NET Core SDK is installed: enter image description here

Strangely enough though, when I search for the SDK in the command line (with the command dotnet --info)... nothing appears: enter image description here

It looks like the Microsoft .NET Core SDK 3.1.302 is installed, but it cannot be located by the system.



Solution 1:[1]

Add environment variable using following steps

If your operating system is windows 10, Right click "This PC" -> Properties Properties

Then click "Advance system settings" and click "Environment Variable" button as follow

Environment variable

Then select the path and click Edit button User Variables for Administrator

For the above error you have to add dotnet location. Click New and add dotnet file path. C:\Program Files\dotnet

File path

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Buddhi Kandegama