ChatGPT解决这个技术问题 Extra ChatGPT

.NET Core 2.2 Can't be Selected In Visual Studio Build Framework

Previously, I was able to select the .NET Core 2.2 Framework in the properties section of the .NET Core project, but after the latest visual studio updates I haven't been able to.

https://i.stack.imgur.com/qKU8w.png

Things I've tried:

Repairing the .NET Core 2.2 SDK installation

Uninstalling and Reinstalling the .NET Core 2.2 SDK

Restarting Visual Studio

Restarting my machine

Making a fresh .NET Core project

Nothing has been able to work. From the fact that it was working before I installed the latest updates, could it just be a bug? Or is there something that I'm missing?

For some more clarity, I'm running in Windows 10 Professional x64 on the latest version of windows.

I installed this version of .NET Core 2.2 from here

https://i.stack.imgur.com/TIhxO.png

Any help is appreciated. Thanks!

Just had a similar problem after installing Visual Studio 2019. dotnet core 2.1 is now missing for VS 2017 and I don't know how to restore it.

H
Henke

I have same problem. I am trying fix this issue about one day. Finally I figuret out. My VS version is 15.9.11 and Community Edition.

Issue details: 2.1.6xx & 2.2.2xx version of the sdks are only supported on Visual Studio 2019. VS 2017 needs 2.1.5xx & 2.2.1xx versions of the sdk.

How to fix the issue? Install 2.1.5xx version of the SDK if you are targetting a 2.1 app Install 2.2.1xx version of the SDK if you are targetting a 2.2 app.

The link is here

Edit: The direct link to downloadable installers is https://dotnet.microsoft.com/download/dotnet-core/2.2. As noted above, do check which SDK version is compatible with Visual Studio 2019 and/or Visual Studio 2017.

For example, if you want to use .NET version 2.2.7 in Visual Studio 2017 (v15.9), the only SDK version that works is SDK 2.2.109. To use SDK 2.2.206 you must have Visual Studio 2019 (v16.0). To use SDK 2.2.402 you must have Visual Studio 2019 (v16.2).


Finally. I was trying to get .Net Core 2.2 working in VS 2017 and either things weren't showing up as expected or I was getting compat errors like everyone else. After installing VS 2019 and reinstalling net core 2.2 (x64) (because I had uninstalled during troubleshooting), I can create and run 2.2 projects. Would be nice if MS would make this more obvious: "Requires Visual Studio 2019"
Bahadir had the same issue today on a colleagues laptop - really strange I wonder if previous versions of the dotnet core 2.x framework had other dependencies that are missing.
In fact, Microsoft makes that very clear by listing the SDK version/VS version table in .NET Core release notes, such as github.com/dotnet/core/blob/master/release-notes/2.2/2.2.4/… As it is intentional, there is not much to be bargained.
At the very least it would be nice if you got an error when trying to install the SDK on a system that does NOT have VS 2019!
The requirement to use VS 2019 with .NET Core 2.2.+ has been added to the very last line of the dialog box of the .NET Core SDK installer tool now (months later than the above comments), for what it's worth.
P
Phillip Ngan

Configure Visual Studio 2017 15.9 to use the previews of .NET Core SDK (in Options) and restart VS.

Update in 2019:

Microsoft decides that VS2017/2019 should use different .NET Core SDK versions, so make sure you do install the correct versions for your VS versions, and read the official announcement here,

https://github.com/dotnet/announcements/issues/108

You might find the SDK version/VS version table in .NET Core release notes, such as https://github.com/dotnet/core/blob/master/release-notes/2.2/2.2.4/2.2.4.md

Is a good practice to subscribe to the Microsoft .NET and Visual Studio team blogs so that you can always learn the new things, like https://blogs.msdn.microsoft.com/dotnet/2018/11/13/net-core-tooling-update-for-visual-studio-2017-version-15-9/


So, to clarify things a bit, after installing the sdk for x86 and x64, VS didn't pick up version 2.2 of the SDK. Only after updated the global.json file with the precise version did 2.2 appear as an option. I hope this helps!
The answer is apparently not "simple"; don't be condescending. The latest cause of this problem is the release of an updated SDK (2.2.202) that is not compatible with VS 2017.
@NickSilberstein this answer belongs to its question (clearly in 2018), and does not pretend to work also for what Microsoft messed up in 2019.
I was trying to update Visual Studio 2017 last night. Didn't have .Net Core 2.2 install prior so I went to get latest and it refused to show up. Was head-scratching all night. I did not realize that 2.2.202 is not compatible until I read Nick's comment. I thought the 2.x line was going to remain available on VS2017, and .Net Core 3.x would be VS2019. Surprised me!
Me too just now! I went through so many of the .NET Core 2.2 pages and they always led to the 2.2.203 installer. To add to the ridiculous confusion the page title is .NET Core 2.2.4 Update - April 09, 2019 yet there are 2.2.106 for VS2017 and 2.2.203 for VS2019. Egad. Both result in 2.2.4 listed under 'dotnet --info'. WIth 2.2.106 I have it available in VS2017. THANKS!
D
Donald Webb

Visual Studio 2017 and 2019 require specific build versions. Missing these will give this error.

2017 uses x.x.100

2019 uses x.x.200

Latest sdk https://github.com/dotnet/core specific to each vs version.

https://github.com/dotnet/core/blob/master/release-notes/2.2/2.2.4/2.2.4-download.md

2017 install 2.2.106

2019 install 2.2.203

This resolved the issue


This solution worked for me.. I have installed Visual Studio 2017 15.9.04 and .net sdk 2.2.202 version and I'm faced same issue.. then I've installed .net sdk version 2.2.106 Visual Studio 2017 and Visual Studio for Mac 7.8 2.2.106 Visual Studio 2019 (Windows and Mac) 2.2.203
This worked for me. I just updated 2017 15.9.11 then installed .net sdk 2.2.202 and target framework for 2.2 didn't appear in the list. After uninstall 2.2.202 and install 2.2.107. Running VS 2017, Target framework appear nicely.
I was is same situation like others, this worked for me.
I just tried this with version 2.2.108 - dotnet.microsoft.com/download/thank-you/…
I
Ian Mercer

For anyone else landing here after searching for 'the current .net sdk does not support targeting .net core 2.2 ...' make sure you have the right platform selected for the download: Use x86 not x64 when running in Visual Studio in 32-bit mode (which is currently always the case).


Use x86 not x64 when running in Visual Studio in 32-bit mode (which is currently always the case). - this is not entirely true. I first installed 32-bit as this answer says, didn't work, uninstalled it and installed 64-bit, it worked. FWIW, this is the error I got after installing 32-bit.
This was not the case for me. The x64 SDK works great on my x64 OS (Win7) with a standard install of Visual Studio. The problem turned out to be that I had installed the version of the SDK that shipped w/ VS 2019, and does not appear compatible with VS 2017. After uninstalling, and installing the x64 2.2.105 SDK the problem was fixed.
@NickSilberstein That would make a great alternative answer. There's lots of failure modes here not one right answer.
M
Mario

Using 2017 15.9.11 with only 2.2.202 (run dotnet --info to see what is installed) I could not have 2.2 selected in the drop down and would get the error "The current .NET SDK does not support targeting .NET Core 2.2".

Once I installed 2.2.104 I was able to compile and select 2.2 in the framework selection drop-down.

Dear MS - VS is WAY TOO BUGGY LATELY. I really do not appreciate the instability of things since you have gone to agile.


Agreed. I was able to dotnet build just fine from the command line with 2.2.202, but Visual Studio wouldn't work with it. I had to downgrade to 2.2.105. There is nothing posted at docs.microsoft.com/en-us/dotnet/core/… about this, which is unfortunate.
A
Amila Thennakoon

Please choose the correct .net Core framework. Visual Studio 2017 v 15.9.12 compatible with .Net Core SDK 2.2.107 .SDK 2.2.300 compatible with Visual Studio 2019

https://i.stack.imgur.com/ArDGA.png

https://i.stack.imgur.com/twkpa.png


d
daviesdoesit

If anyone has an error restoring a .net core framework dependency during a build with Azure DevOps (VSTS), it may be due to the build agent (Hosted VS 2017 in my case), not having the .net core SDK available.

I added the missing .net core SDK (2.2 in my case) by adding a build step as instructed by this blog post: Build .NET Core 2.2 Projects on Azure DevOps by Edi Wang

From Microsoft Docs

The Microsoft-hosted agents don't include some of the older versions of the .NET Core SDK. They also don't typically include prerelease versions. If you need these kinds of SDKs on Microsoft-hosted agents, add the .NET Core Tool Installer task to the beginning of your process. Azure DevOps Services


M
Mohammed Swillam

For people who are still stuck with compiling .net core apps after installing the latest .net core SDK.

TL;DR:

Depending on your Visual Studio version( 15, 17 or 19) you will need to install specific SDK version (which doesn't have to be the latest available).

so as of today, you may use the following links:

For Visual Studio 2017 (version 15.9 or above), you will need to install SDK version 2.2.106

For Visual Studio 2019 (preview or above), you will need to install SDK version 2.2.203

Full details:

Due to a change made by the Visual Studio team on how visual studio will utilize .net core SDK installed, there is a compatibility table that shows which SDK version is compatible with Visual Studio 2015/2017 and 2019.

This is the blog post highlighting the change: https://devblogs.microsoft.com/dotnet/net-core-tooling-update-for-visual-studio-2017-version-15-9/

To fix the issue you will need to make sure that you are using the SDK version compatible with your Visual Studio version.

Check the table on this page and only install the SDK version compatible with your visual studio version: https://github.com/dotnet/core/blob/master/release-notes/2.2/2.2.4/2.2.4.md


K
Krunal V

I am also facing same problem (core 2.2 framework not coming in target framework drop down) so to solve this problem follow following steps:

Install latest core version from here. Find global.json file in folder (C:\Users[username]), change the version of core framework in this file. Restart the visual studio.

Hope this will help you!


Removing global.json from user-directory did the trick for me!
This solved my problem after spending hours on it, Thank you!
A
Andrew

Update for VS .Net Core SDK 2.2.107

This page .net core downloads has link for 2.2.107 sdk specially for VS 2017. I needed this even though I could see the 2.2 core option from the project dropdown within visual studio.

Minor release increment but apparently they changed the underlying ms build github dotnet core which baulked vs 2017. Furthermore VS 2017 15.9.12 wasn't showing any further update requirements.

Also the global.json and project.json etc has gone and instead the csproj file is now used.


l
live-love

If you are getting this error when building:

The Current .Net SDK does not support targeting .Net Core 2.2 Target ...

Download the latest .NET Core SDK here:

https://dotnet.microsoft.com/download

Install it.

Find global.json file in folder (C:\Users[username]), change the version of core framework in this file (if needed).

Restart VS and try building again.


S
Serhat Oz

After strgugling sometime I have found this solution, from this microsoft page: https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral

I have installed Visual Studion 2017 Sdk > x64 SDK

https://i.stack.imgur.com/dFBEx.png