Visual Studio中找不到.Net Core SDK

在win 7 64位上安装了.Net Core 2.1 x86 SDK后,又卸载重新安装了.Net Core 3/2 x64 SDK。结果在VS中新建项目时没有.Net Core 3.1 SDK。

在cmd中运行dotnet --info,.Net Core SDKs installed里提示No SDKs were found

这个是由于环境变量里同时配置了C:Program Files (x86)dotnet 和 C:Program Filesdotnet。导致运行dotnet命令时执行的是C:Program Files (x86)dotnet下。

在环境变量中把C:Program Files (x86)dotnet 取消。重新运行dotnet --info后恢复了正常,.Net Core SDKs intallled里2.1和3.1的SDK都有了。

重新打开VS新建项目也都正常了。

原文地址:https://www.cnblogs.com/xbzhu/p/12057111.html