This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.2 target framework


If you've found your way here it's because you've installed some shiny new NuGet packages into your project which builds and runs fine but gets the below error message when trying to publish to Azure (or somewhere via a publish profile in Visual Studio).

This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.2 target framework.  Please target netcoreapp2.2 or choose a version of Microsoft.AspNetCore.App compatible with netcoreapp2.1

The TL;DR answer is you're looking for is that the publish profile was not updated after your NuGet packages for .Net Core were upgraded (it's complaining that it's trying to publish the incorrect version).

In the publish profile you'll have the following line of XML that you'll want to change. Do note that your version numbers might be different so use the version from the error message you received.

Old XML

<TargetFramework>netcoreapp2.1</TargetFramework>

New XML

<TargetFramework>netcoreapp2.2</TargetFramework>

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.