17

I just cloned into an already existing project for work, and have found that for some reason, Visual Studio refuses to show .NET Core 2.2 in the "Target Framework" dropdown menu in the Properties -> Application menu.

I have installed .NET Core 2.2 (by clicking "install other frameworks" and downloading/running the 2.2 SDK file. I have originally installed the x64 version as that's what my boss uses, but I later also installed the x84 version to see if that worked. Neither works.), and confirmed that this is correctly installed. I did this by running the command "dotnet --info" in the shell, which outputs the following:

.NET Core SDK (reflecting any global.json):
 Version:   2.2.101
 Commit:    236713b0b7

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.101\

Host (useful for support):
  Version: 2.2.0
  Commit:  1249f08fed

.NET Core SDKs installed:
  1.1.11 [C:\Program Files\dotnet\sdk]
  2.2.101 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Still, there are no .NET Core 2.2 in the Target Framework dropdown. There are only two options currently: .NETCoreApp 1.0 and .NETCoreApp 1.1

I've got Visual Studio 2017, and as far as I can tell from the About page, version 15.0.0

TheJack38
  • 384
  • 1
  • 3
  • 13

6 Answers6

46

I was having the same issue after downloading the latest dotnet-SDK-2.2.202 (at the moment). Tried everything on this thread and nothing worked.

I also recently updated to the latest VStudio 2017 - 15.9.11

Then I downloaded and installed the previous dotnet-SDK-2.2.105 available and it fixed the issue.

Find it here: https://dotnet.microsoft.com/download/dotnet-core/2.2

Javier Alvarez
  • 471
  • 1
  • 4
  • 5
  • 1
    Did this the trick for me even though I have 2 later versions installed! – PmanAce Apr 06 '19 at 00:51
  • 2
    This worked for me as well. It sounds like Visual studio 2017 can recognize .net core 2.2.105 but not 2.2.202 (at least in my case). Another thing I didn't try is that update my visual studio to 2018 from 2017. – Thiru Apr 06 '19 at 01:03
  • This works for me too. Installed the latest version then installed the version before it. – Ronald Abellano May 14 '19 at 12:30
  • It's ridiculous you have to do this but it works, thank you for sharing. I guess we all should move to using VS2019. – Roberto Navarro Oct 25 '19 at 17:41
  • Installing 2.2.105vdidnt help me at all .I am using VS 2017 15.9 .Any Idea folks? – shivi Dec 01 '19 at 15:22
  • On the link provided, it actually states which version of Visual Studio 2017 these SDKs support. At the time of comment -> 2.2.207 (VS 16.0), 2.2.110 (VS 15.9) – Naxin Jan 08 '20 at 05:48
  • Seems you also need to select x86/x64 that matches the install of Visual Studio you have. I.e. I'm running x86 VS on my x64 machine, and needed x86 SDK. – Naxin Jan 08 '20 at 05:53
15

.net core SDK 2.2.202 requires MS build 16 to work. So you would need to install Visual Studio 2019.

See 2.2.202-SDK not available in Visual Studio 2017 #2542

Greenonline
  • 1,330
  • 8
  • 23
  • 31
Alex Nazarevych
  • 456
  • 4
  • 7
  • 1
    thanks - I was dealing with this exact problem today. Looks like .net core developers are all using 2019 and forgot to update 2017 – Iofacture Apr 08 '19 at 21:18
  • This worked for me... :( – Tim Reilly Apr 11 '19 at 17:28
  • This is the correct answer for those who .NET Core 2.2 didn't show up in the drop-down on the latest VS 2017 (version 5.9) – Aday Apr 12 '19 at 14:59
  • Not true any more see https://dotnet.microsoft.com/download - there is a special download for VS 2017. I needed this even though I could see 2.2 sdk option in visual studio project dropdown. VS 15.9.12 – Andrew May 22 '19 at 08:38
11

Your Visual Studio Version is not up to date. You need to update it.

Visual Studio 2017 15.9 uses .NET Core 2.1 SDK by default after the workload is installed.

To update Visual Studio to use .NET Core 2.2 SDK:

Install the .NET Core 2.2 SDK.

Reference

PS: You need to restart visual studio. After you the installation of .Net Core 2.2 SDK.

Community
  • 1
  • 1
Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72
  • 3
    To be more exact,at the time of this writing, 15.9 is the current visual studio. 2.2 support was added some time back - but NOT in 15.0. Run the installer and it will SCREAM for you to install a big update. – TomTom Jan 08 '19 at 09:32
  • This worked! I thought I had the latest stable version of Visual Studio, but apparantly assuming that was incorrect. After I updated to 15.9, all the SDKs showed correctly (even ones I didn't know were installed, such as 2.0 and 2.1) – TheJack38 Jan 08 '19 at 10:00
  • Check the CORRECT answer below by Javier Alvarez – Mauricio Gracia Gutierrez Jun 04 '19 at 02:43
9

I had the same issue, and the Core 2.2 did not show up on the Visual Studio in the Target platforms dropdown. I did everything answered above and still had the same issue. Finally I ended up creating a new global json config using

dotnet new globaljson --sdk-version 2.2.101 --force

Restarting Visual Studio after the above step worked for me.

Arun Mohan
  • 101
  • 3
  • 1
    When I do this I am getting an error that "one or more projects in the solution were not loaded correctly". The output says (for the project that is targeting 2.2: : `error : Project file is incomplete. Expected imports are missing.` – CularBytes Apr 04 '19 at 09:28
0

Check to see if there is a global.json file in the same folder as your solution file. I removed it and everything is working again.

kdahl
  • 79
  • 5
  • This was the issue for me! Thank you! Ref: https://learn.microsoft.com/en-us/dotnet/core/tools/global-json?tabs=netcore3x – Ryan Oct 07 '20 at 18:33
-1

I was having the same problem in my VS 2017 -version 15.8 I tried by update the vs2017 to the latest version 15.9.11 and installed the latest .net core 2.2.203 SDK, but still not getting the desired target framework 2.2

When I installed the .net core 2.2.105 SDK and after restarting the VS, I got the target framework 2.2

Towhidul Islam Tuhin
  • 1,051
  • 13
  • 10
  • This may be correct for some cases, but what SDK version is on the global.json would be the right culprit, when you upgrade to newer versions of Visual Studio, it needs a specific supported version. – nithinmohantk Jun 24 '19 at 08:43