The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found

Visual Studio.Net Core

Visual Studio Problem Overview


I am using Visual Studio 2019 Version 16.3.7. I assume it is the latest update.

When I try to compile a basic .NET Core 2.2 console application:

enter image description here

...I get the following error:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found.
  - The following frameworks were found:
      1.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.11 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.12 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.1.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      3.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The .NET Core frameworks can be found at:
  - https://aka.ms/dotnet-download .

enter image description here

My understanding is that .NET Core 3.0 is backward compatible. Why Visual Studio installer installed all versions of .NET Core except 2.2? How do I solve this problem?

Visual Studio Solutions


Solution 1 - Visual Studio

For whatever reason, .NET Core 2.2 is not installed by the ".NET Core cross-platform development" workload.

Open up the Visual Studio installer then go to the "Individual components" tab and you can install it from there:

enter image description here

enter image description here

enter image description here

Solution 2 - Visual Studio

In my case was missing x86 .NET Core 2.2.x Platform SDK (Visual Studio .NET 16.4 + .NET Core 3.1 SDK ; xUnit Test Project).

You can try this:

  1. Exist directory 2.2.x in: C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App ?
  2. When no, try Download latest 2.2.x SDK for x86 platform from this URL: https://dotnet.microsoft.com/download/dotnet-core/2.2
  3. Install and try ...
  4. For more info about installed SDK and Runtime you can use command: dotnet --info

Solution 3 - Visual Studio

For those trying to deploy a file to a non-developer machine and you see this error, use the Project -> Publish option with a Folder Profile and update the settings to be "Deployment mode: Self-contained". Then "Publish" it.

This will embed the runtime into the .exe, making it much larger, but also simple to "just work" on a client machine.

enter image description here

Solution 4 - Visual Studio

You can install x86 .NET Core 2.2.x Platform SDK as @Martin said.

If you do not need x86 version like me, you can also set

<PlatformTarget>AnyCPU</PlatformTarget>

to

 <PlatformTarget>x64</PlatformTarget>

in both main project and test project 's .csproj file

to avoid this problem.

Solution 5 - Visual Studio

Two options are to run the Visual Studio Update application to see if any missing requirements will be installed for you or to install the net core 2.2 SDK manually from https://dotnet.microsoft.com/download/dotnet-core/2.2 (or https://aka.ms/dotnet-download as mentioned in the error message).

Solution 6 - Visual Studio

.NET Core 2.2.0 is not supported anymore. Waiting for the .NET 5

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAllan XuView Question on Stackoverflow
Solution 1 - Visual StudioStephen KennedyView Answer on Stackoverflow
Solution 2 - Visual StudioMartinView Answer on Stackoverflow
Solution 3 - Visual Studiog01dView Answer on Stackoverflow
Solution 4 - Visual StudioJamieView Answer on Stackoverflow
Solution 5 - Visual StudioBabak NaffasView Answer on Stackoverflow
Solution 6 - Visual StudioSurferView Answer on Stackoverflow