Search code examples
c#asp.net-core.net-corevisual-studio-2019asp.net-core-3.1

Microsoft Visual Studio 2019: The project file cannot be opened. Unable to locate the .NET SDK


I just upgraded my visual studio 2019 to latest version 16.8.3 and suddenly I am not able to load any C# project and getting the following error for all .NET core projects:

The project file cannot be opened. Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.


Solution

  • Try to edit environment Variables.

    Right click on This PC -> Properties -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables

    Add [install path] C:\Program Files\dotnet\ to the variable path.

    Restart visual studio.

    If it does not solve this problem, you can refer to this answer.