Package dotnet-aspnet-codegenerator 5.0.1 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any. Package dotnet-aspnet-codegenerator 5.0.1 supports: net50 (.NETFramework,Version=v5.0) code example

Example: error NU1202: Package dotnet-aspnet-codegenerator 5.0.1 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any. Package dotnet-aspnet-codegenerator 5.0.1 supports: net5.0 (.NETCoreApp,Version=v5.0)

//Update your .NET SDK to 5.0

//Change your target framework to in your project .csproj

  <PropertyGroup>
    <TargetFramework>netcoreapp5.0</TargetFramework>
  </PropertyGroup>