当前的.NET SDK不支持定位.NET Core 3.0.3.1 |5.0 [英] The current .NET SDK does not support targeting .NET Core 3.0 | 3.1 | 5.0
问题描述
我刚刚下载了.NET Core 3.0.100的发行版.
它与我安装的旧版本一起安装:
当我尝试针对.NET Core 3(< TargetFramework> netcoreapp3.0</TargetFramework>
)的项目运行 dotnet restore
时,我得到了错误
<代码> C:\ Program Files \ dotnet \ sdk \ 2.2.202 \ Sdks \ Microsoft.NET.Sdk \ targets \ Microsoft.NET.TargetFrameworkInference.targets(137,5):错误NETSDK1045:当前.NETSDK不支持定位.NET Core 3.0.目标.NET Core 2.2或更低版本,或者使用支持.NET Core 3.0的.NET SDK版本.
我有一个global.json文件,该文件明确指出我需要 3.0.100
SDK
{"sdk":{版本":"3.0.100"}}
我知道我可以编辑 MSBuildSDKsPath
env变量以指向 3.0.100
SDK,它可以工作,但我不想这样做,我的机器上还有其他项目,仍需要使用旧版本的.NET Core.
是否有一种方法可以使 dotnet
工具使用 global.json
中声明的SDK而不是 MSBuildSDKsPath
中的SDK?
我使用Visual Studio代码
您还必须将 visual studio
更新到支持的最低版本:
.NET Core 3.0
- 最低
Visual Studio v16.3
.NET Core 3.1
- 最低
visual studio v16.5
.NET Core 5.0
- 最低
Visual Studio v16.6最新预览版
(
(
( https://dotnet.microsoft.com/download/dotnet/5.0 )
I've just downloaded the release version of .NET Core 3.0.100
It was installed alongside older version that I have:
When I try to run dotnet restore
for a project that targets .NET Core 3 (<TargetFramework>netcoreapp3.0</TargetFramework>
), I get this error
C:\Program Files\dotnet\sdk\2.2.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0.
I have a global.json file that explicitly states that I need the 3.0.100
SDK
{
"sdk": {
"version": "3.0.100"
}
}
I know that I can edit the MSBuildSDKsPath
env variable to point to the 3.0.100
SDK, and it works, but I don't want to do it, I have other projects on my machine that still need to use older versions of .NET Core.
Is there a way to make the dotnet
tool use the SDK that's stated in global.json
instead of the one in MSBuildSDKsPath
?
Edit: I use Visual Studio Code
You also have to update your visual studio
to the minimum supported version:
.NET Core 3.0
- minimum
visual studio v16.3
.NET Core 3.1
- minimum
visual studio v16.5
.NET Core 5.0
- minimum
visual studio v16.6 latest preview
(https://dotnet.microsoft.com/download/dotnet-core/3.0)
(https://dotnet.microsoft.com/download/dotnet-core/3.1)
(https://dotnet.microsoft.com/download/dotnet/5.0)
这篇关于当前的.NET SDK不支持定位.NET Core 3.0.3.1 |5.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!