56

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?

1
  • when 3.0 framework is installed shouldn't you be able to build .net core 2.2 application?
    – SharpCoder
    Mar 16, 2021 at 21:35

8 Answers 8

83

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

2
38

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
6
  • 2
    @Martin Thanks for the answer. But why it was looking under x86 folder when the machine where it is running is 64 bit. Dec 23, 2019 at 10:44
  • 1
    This worked for me as well; I was getting this error from NUnit. @DeepakTekchandani I believe x86 is required because the IDE is 32-bit (yes, even 2019) and so extensions rely on 32-bit SDKs. (I could be mistaken though.)
    – Jay
    Dec 30, 2019 at 16:46
  • 1
    This fixed my issue as well.
    – Kaz
    Feb 14, 2020 at 16:46
  • This solved my issue as well. I kept trying to install x64, which did not work as expected. Installing x86 worked as a charm.
    – marsop
    Feb 27, 2020 at 7:10
  • 1
    @DeepakTekchandani I think that is because some .NET project package uses older 32-bit code ; 64 bit system can run both code: 32 and 64-bits. Solution was surprise in this case :)
    – Martin
    Feb 27, 2020 at 7:59
4

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

1

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.

0

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

2
  • This is the very latest upated visual studio 2019, confirmed by visual studio installer. Why Visual Studio installer installed all versions of netcore except 2.2?
    – Allan Xu
    Nov 4, 2019 at 22:55
  • 2.2 has reached its end of life and is no longer supported.
    – CountZero
    Jun 1, 2020 at 19:42
0

This case in only applicable for already running app, and then you are trying to deploy a new release with new published files with updated version of dotnet.

if you are deploying on the same dotnet version but minor version is different for example current release is 7.0.0 and new update is 7.0.1

then dont update project_name.deps.json and project_name.runtimeconfig.json

and update remaining changed dlls.

0

In the case you are using VS Code, you can change the .csproj file in the <TargetFramework>netcoreapp3.0</TargetFramework> tag. Change it to the installed version, like <TargetFramework>netcoreapp7.0</TargetFramework>.

-3

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

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.