Remove any <PackageReference> to Microsoft.AspNetCore.App from your .csproj. Use <Project Sdk="Microsoft.NET.Sdk.Web"> and update <TargetFramework>net6.0</TargetFramework>. If you need AspNetCore features without the Web SDK, add <FrameworkReference Include="Microsoft.AspNetCore.App" />.