The current .NET SDK does not support targeting .NET Core 2.2. (SDK 2.2.202)

CularBytes picture CularBytes · Apr 4, 2019 · Viewed 7.9k times · Source

Another one of those many many similar issues, yet none of the solutions searched for, helped (see below which one are looked at).

At the moment of writing this, .NET Core v2.2 is out of preview, the latest version being v2.2.202 (release date, 02-04-2019).

I installed that one via "Install other frameworks", I installed the x64 one, all other versions I have installed earlier are also that version.

After installing, when I create a new project, it shows up:

enter image description here

But when I then open the properties, it does not:

enter image description here

enter image description here

dotnet --info within the directory of the project, gives the following result:

.NET Core SDK (reflecting any global.json):
 Version:   2.2.202
 Commit:    8a7ff6789d

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

Host (useful for support):
  Version: 2.2.3
  Commit:  6b8ad509b6

.NET Core SDKs installed:
  2.1.2 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.401 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.2.202 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

I have tried:

  • Create a global.json (SO answer), this only produced more errors as it could not load the project that is targeting v2.2
  • Enable preview SDKs within Settings (SO answer)
  • I have tried installing the x86 version, but that gave also more errors as it was confused about which one to use now. So that started complaining about .NET Standard not being installed.
  • I have updated Visual Studio and Visual Studio Build Tools to the latest versions, which is 15.9.11 (release date, 02-04-2019)
  • When I build via the command line dotnet build in the solution directory, it builds successfully, so it must be a visual studio thing.
  • verified that only C:\Program Files\dotnet\ is in the Environment Variables, so C:\Program Files (x86)\dotnet\ is not present.
  • Looked at these options, did all of them but I did not set the MSBuildSDKsPath environment variable since I have other projects also in need with 2.1. I checked that there is currently no MSBuildSDKsPath set so it should not be forced to that version.

enter image description here

All of the above attempts of course involving restarting the computer or restarting VS.

Answer

Martin Ullrich picture Martin Ullrich · Apr 4, 2019

This most likely looks like an installer optimisation for VS that removes old SDKs being too greedy and remove versions that older VS versions rely on, but at the moment this is more of an hypothesis while MS teams are investigating. See this GitHub issue for more similar reports.

The 2.2.1xx SDK(!) versions use MSBuild 15 and the 2.2.2xx use MSBuild 16.

VS 2017 needs to resolve a local version that is compatible with MSBuild 15 so if 2.2.1xx was removed during an upgrade, this may fail.

You can fix this by re-installing a compatible version - e.g. 2.2.105 - from https://dotnet.microsoft.com/download/dotnet-core/2.2

In order to find out which SDK uses which components, you can check the DependencyVersions.props file in the <3.0 sources and the Versions.props file for >= 3.0 (preview) sources - MSBuild version is set in via the MicrosoftBuildPackageVersion property.