Question Error NETSDK1045: Does Not Recognize .NET Core 2.2

code1ca

New member
Joined
Dec 26, 2021
Messages
3
Programming Experience
5-10
Hello All,

Wondering why my system is giving me the message: "Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2 ... use a version of the .NET SDK that supports .NET Core 2.2"

I put line numbers below for ease in illustrating where I'm coming from. From what I can tell based on the Package Manager Console (see line numbers 19, 23, 25 and 28 below) I have .NET Core 2.2,
am I correct? If I already have .NET Core 2.2, then I wonder what am I missing that is preventing a successful program run?

To make sure I am not missing any detail in showing what I am seeing, I have uploaded the full solution to github shown in the link:

If I uninstall then reinstall things in a trial and error fashion hoping that somehow it can get fixed, I can actually do more harm than good, so I do not wish to pretend having significant experience
installing Visual Studio and .NET Core 2.2; instead I'd like to ask the guidance of experts here who have more experience than I do in this area.

1 From Error List Window:
2 Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2.
3
4 From Package Manager Console:
5
6 PM> dotnet --info
7 .NET SDK (reflecting any global.json):
8 Version: 6.0.101
9 Runtime Environment:
10 OS Name: Windows
11 OS Version: 6.3.9600
12 OS Platform: Windows
13 RID: win81-x64
14 Base Path: C:\Program Files\dotnet\sdk\6.0.101\
15 Host (useful for support):
16 Version: 6.0.1
17 .NET SDKs installed:
18 2.1.526 [C:\Program Files\dotnet\sdk]
19 2.2.207 [C:\Program Files\dotnet\sdk]
20 6.0.101 [C:\Program Files\dotnet\sdk]
21 .NET runtimes installed:
22 Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
23 Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
24 Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
25 Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
26 Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
27 Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
28 Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
29 Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
30 Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
 
What's unclear about line #2 from your error output?
C#:
Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2

Anyway, .NET Core 2.2 hit end of life back in Dec, 2019. You'll probably want to leap ahead all the way to .NET 6, or .NET Core 3.1 which are still in support. You'll also need to update your .NET SDK. All of these can be downloaded from:
or
 
What's unclear about line #2 from your error output?
C#:
Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2

Anyway, .NET Core 2.2 hit end of life back in Dec, 2019. You'll probably want to leap ahead all the way to .NET 6, or .NET Core 3.1 which are still in support. You'll also need to update your .NET SDK. All of these can be downloaded from:
or
Thanks for your kind response, unfortunately, I am limited to a Windows 8.1 operating for now so it does not look like
SDK 6.0.101 or SDK 3.1.416 are on the table as they both require Windows 10.

You are right, the error message is giving an indication, I looked at it closer and noticed I am running Microsoft .NET Framework Version 4.7.02053 on Microsoft Visual Studio 2017, using SDK 2.2.207 (from the Microsoft download site Download .NET Core 2.2 (Linux, macOS, and Windows) ) and therein lies the problem.

I can't believe it skipped my eyes that SDK 2.2.207 has Visual Studio support for Visual Studio 2019 so obviously the SDK I should have
installed was SDK 2.2.110 as it is the one carrying Visual Studio support for Visual Studio 2017 not SDK 2.2.207 so it's my bad.

Can I uninstall SDK 2.2.207 and restart and then install SDK 2.2.110 without any problem?
 
Unless you have an extended support contract with Microsoft, Windows 8.1 hit end of life Jan 9, 2018.

I'm not quite sure what version of the SDK VS2017 wants to have with it. You can try using the tool that MS provides to see if it's safe to do:


The tool also provides links to documentation on how to recover in case uninstalling a particular version accidentally breaks something.
 
Unless you have an extended support contract with Microsoft, Windows 8.1 hit end of life Jan 9, 2018.

I'm not quite sure what version of the SDK VS2017 wants to have with it. You can try using the tool that MS provides to see if it's safe to do:


The tool also provides links to documentation on how to recover in case uninstalling a particular version accidentally breaks something.
The tool you shared is pure gold, thanks so much
 

Latest posts

Back
Top Bottom