Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The current .NET SDK does not support targeting .NET Core 3.0 | 3.1 | 5.0 | 6.0

I've just downloaded the release version of .NET Core 3.0.100
It was installed alongside older version that I have:

enter image description here

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

like image 906
user10962730 Avatar asked Sep 24 '19 06:09

user10962730


People also ask

How do I target net SDK in Visual Studio?

NET SDK version, you also need to set the option to enable previews in Visual Studio. Go to Tools > Options > Environment > Preview Features, and make sure that Use previews of the . NET Core SDK is checked.

Does .NET SDK include .NET Core?

The software development kit (SDK) includes everything you need to build and run . NET Core applications, using command-line tools and any editor (like Visual Studio). The runtime includes everything you need to run . NET Core applications.

What is my current .NET SDK version?

You can see both the SDK versions and runtime versions with the command dotnet --info . You'll also get other environmental related information, such as the operating system version and runtime identifier (RID).

Is .NET Core 3.1 still supported?

NET Core 3.1 was originally released on December 3, 2019 and is supported for three years. But the actual end of support day will be the closest Patch Tuesday starting that date, which is December 13, 2022.

What version of the NET SDK does not support targeting core?

It gives the error of "The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 3.0 or lower, or use a version of the .NET SDK that supports .NET Core 3.1."

Does the SDK package for the SDK support the target object?

the current SDK package for .NET does not support the target object .NET Core 6.0. Select .NET Core 5.0 or earlier, or use the version of the .NET SDK that supports .NET Core 6.0. Question: How to fix the error? I couldn't figure out the best area label to add to this issue.

Does Visual Studio support targeting NET Core?

blog.matrixpost.net Visual Studio The current .NET SDK does not support targeting .NET Core. The current .NET SDK does not support targeting .NET Core. by Marcus Rath 15. May 2021 If you run into an .NET Core compiling error regarding targeting .NET Core version not supported in Visual Studio like this one:

What is the error code for netsdk build?

.NetSDK – Build – Error – NETSDK1045 – “The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 3.0 or l ower, or use a version of the .NET SDK that supports .NET Core 3.1.” | Learning in the Open Home .NetSDK – Build – Error – NETSDK1045 – “The current .NET SDK does not support targeting .NET Core 3.1.


Video Answer


1 Answers

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

enter image description here

(https://dotnet.microsoft.com/download/dotnet-core/3.0)


![enter image description here

(https://dotnet.microsoft.com/download/dotnet-core/3.1)


enter image description here

(https://dotnet.microsoft.com/download/dotnet/5.0)


enter image description here

(https://dotnet.microsoft.com/download/dotnet/6.0)

like image 101
Dominic Jonas Avatar answered Sep 21 '22 09:09

Dominic Jonas