[VS2022錯誤訊息] Unable to locate the .NET SDK … global.json
安裝 VS 2022以後,舊版VS2019 出現 .NET Core 5 / .NET Standard 2專案無法載入。
錯誤訊息 — 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.
引述 —
As all .NET developers I am quite excited by Visual Studio 2022 and .NET 6 going RTM. However I noticed that Visual Studio 2022 RTM install messed up Visual Studio 2019. Our .NET 5 and .NET Standard 2 projects couldn’t be loaded anymore in Visual Studio 2019. The error shown when attempting to load the projects was:
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.
Hamid Mosalla compiled . However none of those solutions worked. After an hour googling and tweaking I found the solution here . In your system environment variable path,
Visual Studio 2022 put C:\Program Files (x86)\dotnet\ before C:\Program Files\dotnet\. Just restore the right order et voilà 🙂