Edit

Share via


NuGet Error NU1010

The following PackageReference items do not define a corresponding PackageVersion item: PackageName. Projects using Central Package Management must declare PackageReference and PackageVersion items with matching names

Issue

A project is configured to use NuGet Central Package Management and a <PackageReference /> item is defined but a corresponding <PackageVersion /> item with the same name is not defined in the Directory.Packages.props file:

<ItemGroup>
  <PackageReference Include="PackageName" />
</ItemGroup>

Solution

  • Define a <PackageVersion /> item that specifies the version in the Directory.Packages.props file with the same identifier as the <PackageReference /> item:

    <ItemGroup>
      <PackageVersion Include="PackageName" Version="5.0.1" />
    </ItemGroup>
    
  • If a <PackageVersion /> item is properly defined and this error occurs in Visual Studio, check the Error List window for errors related to loading the project or failed design time builds. If Visual Studio is not able to successfully load the project or a design time build fails, NuGet may log this error because it does not have the required information to restore. Resolving these underlying issues should fix this error.