6
votes

Solution found! Took awhile, installed ALL sdks, and ALL runtimes then reinstalled latest version I wanted!

Goal, Have netcore 2.1 or greater as a dropdown option in visual studio. I've looked at possible duplicates questions already!

Details

After the last update of visual studio 15.7 to 15.8.4 .net core 2.1 or greater has disappeared from the target framework list.

I looked at other solutions as seen below. They were not helpful as I installed every version under the sun. See below screens.

Checked below for solutions (I already looked for solutions here!): VS2017 : Target framework drop down does not show .NET Core 2.1 option

The current .NET SDK does not support targeting .NET Core 2.1. target .NET Core 2.0 or lower or use a vs of the .NET SDK that support NET Core 2.1

Referenced screens: enter image description here enter image description here enter image description here enter image description here

UPDATE1: Removed 2.2 preview (NOT SOLVED, 2.1 is still missing) enter image description here

4
remove .net core 2.2 preview2 SDK and look if this restores 2.1 - magicandre1981
Please read post before suggesting duplicate - Ya Wang
@magicandre1981 No dice man. If you have any other suggestions please let me know. Thanks! - Ya Wang
try to move all older (1.0 preview, old 2.0, 2.1) SDKs out of SDK folder to desktop to reduce amount of listed SDKs. Maybe VS has an issue with having too many items there. - magicandre1981

4 Answers

22
votes

In general, when new preview version of .NET Core 2.X appears and you are getting the error like this:

The current .NET SDK does not support targeting .NET Core 2.X

Make sure that:

  1. You have downloaded installed SDK and runtime you need. Run command dotnet --info to see what you have installed on your machine at the moment.

  2. You have checked the Use previews of the .NET Core SDK option here:

-> Tools -> Options -> Projects and Solutions -> .NET Core

Sometimes you might need to restart your Visual Studio after checking the option.

Note: it's always better to have the most recent Visual Studio version installed on your development machine (sometimes you might need a preview version - note a Download Preview link).

2
votes

The user said, that my comment fixed the issue. So I'll post it as answer:

On the picture I see a lot of installed .Net Core SDKs, maybe Visual Studio has some issues with so many installed SDKs.

So move all old SDK folders (1.0 preview, 2.0, 2.1 except 2.1.402) out of this folder to a backup location and launch Visual Studio again.

0
votes

I had this issue as well, this is what I did and it worked for me, It may or may not for you. I uninstalled everything after 2.0. I then went to this link https://www.microsoft.com/net/download and downloaded both the SDK and Run-time downloads for 2.1 then after installing them I restarted my laptop and booted up VS2017. I then went and tried creating a new web app MVC and selected .netcore 2.1 it was there.

However keep in mind .netcore 2.1 is not yet available for every template you have so check web app MVC template first if its there then you have 2.1 it just may not be available for a specific template you might be trying to use it for yet.

Hope this helps

0
votes

In my case solution was: i removed few .NET Core SDK:s from "Add remove programs" and restarted visual studio. Than SDK that i need was in the list