The current .NET SDK does not support targeting .NET Core 3.0 | 3.1 | 5.0 | 6.0
Solution 1
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
.NET Core 6.0
- minimum
visual studio v17.0 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)
(https://dotnet.microsoft.com/download/dotnet/6.0)
Solution 2
I got this error in Azure DevOps with .NET 6:
error NETSDK1045: The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0.
Solved by including the SDK like this:
steps:
- task: UseDotNet@2
displayName: 'Install .NET 6 SDK'
inputs:
version: 6.0.x
performMultiLevelLookup: true
Github thread about the issue:
https://github.com/dotnet/core/issues/6907

user10962730
Updated on July 09, 2022Comments
-
user10962730 over 1 year
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 errorC:\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 the3.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 inglobal.json
instead of the one inMSBuildSDKsPath
?Edit: I use Visual Studio Code
-
Dominic Jonas about 4 yearsDid you solve it? Maybe there is also an update for
vscode
needed -
Cardi DeMonaco Jr about 4 yearsI had VS version 16.2.5, installed 16.3.7, and it fixed the issue!
-
Steve G almost 4 yearsI was having this problem with VS CODE. I updated VISUAL STUDIO to v16.3 and now VS Code is working properly. If you read through the error listing in VS Code, it references Visual Studio. That was my clue. Updated Visual Studio and all is good.
-
Josh Gust almost 4 yearsThis answer is also relevant to users of Azure DevOps as a CI platform. The build agent (hosted or on-prem) needs to have access to the appropriate install of VS 2019 and using the appropriate dotnet tools version to build 3.0/3.1 projects.
-
Danie over 3 yearsThis solved the issue for me. Had the problem in a azure devops pipeline, and changing my build agent from a vs17 to 19 solved the problem. Thanks!
-
Mronzer over 3 years@Danie I am faced with the same issue, where in the pipeline configuration can one change the build agent?
-
Danie over 3 years@RonnyMahlangu First make sure you have a 2019 build agent in you agent pool, and then in the pipeline settings you choose that in the setting called "Agent Specification".
-
ruffin about 3 yearsArgh. As a follow-on, if you use one version of Visual Studio on a project and then accidentally open the same project in an older version of VS b/c, idk, the icon looks like the same color and shape, this happens as described. ◔_◔
-
Evgeny Gorb over 2 yearsWhen you are installing preview versions of .NET, ensure that 'Use previews of .NET Core SDK' is checked (Tools -> Options -> Preview Features)
-
SarangK over 2 yearsThis is very useful information. I was facing the same issue, it saved my day.