I have an ASP.NET Core project with following csproj
configuration:
<PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.App" /> </ItemGroup>
I want to upgrade the project to <TargetFramework>netcoreapp3.0</TargetFramework>
. Upon doing so, however, I get following warning:
C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\ Microsoft.NET.Sdk.DefaultItems.targets(149,5): warning NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher. If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference should be replaced with a FrameworkReference.
What precisely is the solution to this? I tried to remove reference to Microsoft.AspNetCore.App
, but that does not work. The code does not reference the shared framework.
Also, what does "Otherwise, the PackageReference should be replaced with a FrameworkReference" mean?
Performance improvements ASP.NET Core 3.0 includes many improvements that reduce memory usage and improve throughput: Reduction in memory usage when using the built-in dependency injection container for scoped services. Reduction in allocations across the framework, including middleware scenarios and routing.
NET Framework will be deprecated. This means you can only use . NET Framework as long as your operating systems (for example Windows Server 2019) still supports it. And with Microsoft shortening its support lifecycles, your operating system end-of-life will come sooner than you may think.
NET Core 3.1, as it's backwards compatible with .
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With