0
votes

I couldn't find an answer on the internet yet and I'm not sure if this is a problem or not. When I create a new API project in dotnet Core and try 'nuget update' through the GUI I receive the following error:

NU1202: Package Microsoft.AspNetCore.App 2.2.4 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.AspNetCore.App 2.2.4 supports: netcoreapp2.2 (.NETCoreApp,Version=v2.2)

I've tried updating visual studio, and created a new solution and project, the same thing happened again.

I'm not sure if this is going to be a problem in the near future when adding other packages since it says 'rolling back package changes for...' does this imply that it will rollback all the packages without errors as well?

1
You need to update the targetframework version in the csproj file before updating nuget packages. Aspnet core framework are tightly coupled to the dotnet runtime version. - Kalten
Hi Marcel, what's your VS version? If you do not run the 'nuget update' and directly compile this solution, does this issue persists or not? Per this doc: docs.microsoft.com/en-us/nuget/tools/cli-ref-update, 'update' does not work with the CLI running under Mono (Mac OSX or Linux) or when using the PackageReference format. - Sara Liu - MSFT

1 Answers

1
votes

Microsoft.AspNetCore.App is a special package that in .NET Core 2.1 and 2.2 should be referenced as a package without a version number. The SDK will automatically pull in whatever version is appropriate for that version of the SDK, but it's quite unfortunately that you need the PackageReference in your csproj. It looks like it will no longer be used in .NET Core 3.0 however.

This also means you shouldn't use tools that blindly upgrade this package, since the package shouldn't have a version in your csproj.

If you want to use the latest version of ASP.NET Core, you need to install the latest .NET SDK and change your <TargetFramework> to target the right netcoreapp version.