Introduction
Learn about PackageReference warnings when a NuGet package is added to a Microsoft project targeting .NET 9, for instance, Microsoft.AspNetCore.Mvc.Core without a warning until upgrading to .NET10, at which time a yellow yield icon appears on the package, in this case, Microsoft.AspNetCore.Mvc.Core under dependencies in the Visual Studio project.
Actions
First action, from the developer PowerShell window, change to the root of the project and execute the following.
dotnet list package --vulnerable
We get:
warning NU1510: PackageReference Microsoft.AspNetCore.Mvc.Core will not be pruned. This package is automatically available and does not need to be referenced explicitly. Remove the PackageReference item.
A novice solution seeing NU1510 is shown below because they do not see the entire message where the solution is Remove the PackageReference item as it is part of the framework.
Our project file now as the NuGet package is not required with .NET10 Core.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
Postmortem
When in Visual Studio, and you see a yield icon, run dotnet list package –vulnerable and read the entire output, whether the warning is NU1510 or another. If the recommendation is unclear, do a web search; in most cases, it will return to the Microsoft page for that warning.
Resources
- NuGet Warning NU1510
- Errors and warnings
- PackageReference in project files


Top comments (0)