Upgrading from ASP.NET Core 2.2 to 3.0

If you are building a web project, please make sure the first line of your project file is:

<Project Sdk="Microsoft.NET.Sdk.Web">

In this case, it is automaticly included framework: Microsoft.AspNetCore.App. You don't have to include it again.

https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio#framework-reference

If you are building a razor library not a web project, please make sure the first line of your project file is:

<Project Sdk="Microsoft.NET.Sdk.Razor">

In this case, your library might dependend on some class in ASP.NET Core. You have to add this:

  <ItemGroup>
     <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

Don't forget to add:

    <AddRazorSupportForMvc>true</AddRazorSupportForMvc>

to <PropertyGroup>

If you are not building a razor library nor a web project, typically you don't need Microsoft.AspNetCore.App. If you can really make sure what you are doing and really need it , consider adding:

  <ItemGroup>
     <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

Updating the project file with the following fix it for me:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <UserSecretsId>My-secret</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" />
  </ItemGroup>

</Project>

Reference