6

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

Ya Wang
  • 1,758
  • 1
  • 19
  • 41
  • remove .net core 2.2 preview2 SDK and look if this restores 2.1 – magicandre1981 Sep 17 '18 at 15:09
  • Possible duplicate of [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](https://stackoverflow.com/questions/49171623/the-current-net-sdk-does-not-support-targeting-net-core-2-1-target-net-core) – Dmitry Pavlov Sep 17 '18 at 15:12
  • 1
    Please read post before suggesting duplicate – Ya Wang Sep 17 '18 at 15:16
  • @magicandre1981 No dice man. If you have any other suggestions please let me know. Thanks! – Ya Wang Sep 17 '18 at 15:21
  • 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 Sep 17 '18 at 15:24
  • @magicandre1981 please answer with, that so I can give you points. – Ya Wang Sep 17 '18 at 16:03
  • ok, I posted it as [answer](https://stackoverflow.com/a/52387394/1466046) – magicandre1981 Sep 18 '18 at 13:11

4 Answers4

22

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).

Dmitry Pavlov
  • 30,789
  • 8
  • 97
  • 121
  • 1
    Your answer solved my problem after hours of searching, reinstalling VS2017, rebooting,..! This should be included at least somewhere in the documentations.. frustration was extrem.. arg. – TheRealVira Nov 21 '18 at 09:47
  • Unfortunately, this did not solve it for me. I checked this checkbox and am still getting the error. Am I missing anything else? – rabejens Apr 04 '19 at 12:47
  • Finally installed .NET Core 2.2 SDK(v2.2.107) on windows, same version recomended for Mac – Red May 29 '19 at 01:09
2

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.

magicandre1981
  • 27,895
  • 5
  • 86
  • 127
0

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

Ares
  • 101
  • 1
  • 8
0

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

alexey
  • 783
  • 1
  • 7
  • 19