NuGet "NU1010: The PackageReference items ... have no version" (CPM)
Under Central Package Management every referenced package must have a matching PackageVersion in Directory.Packages.props. NU1010 fires when a project references a package that has no central version to resolve.
What this error means
Restore fails with NU1010 naming the packages that lack a PackageVersion. It is the mirror image of NU1008 - there the version is in the wrong place, here it is missing entirely. It reproduces deterministically.
error NU1010: The PackageReference items Serilog, Polly do not have corresponding
PackageVersion items defined in the Directory.Packages.props.Common causes
A new PackageReference was added without a central version
Someone added <PackageReference Include="Polly" /> to a project under CPM but never added the matching <PackageVersion Include="Polly" ... />, so restore has no version to use.
The Directory.Packages.props is not in scope
If the props file lives in a directory that does not parent the project, MSBuild never imports it and every package looks version-less.
How to fix it
Add the missing PackageVersion centrally
Declare a version for every package the solution references.
<!-- Directory.Packages.props -->
<ItemGroup>
<PackageVersion Include="Serilog" Version="4.1.0" />
<PackageVersion Include="Polly" Version="8.3.0" />
</ItemGroup>Confirm the props file is in scope
- Place
Directory.Packages.propsat or above the solution root so it parents every project. - Run
dotnet build -bland inspect the binlog to confirm the props file is imported. - Re-run restore and verify every reference now resolves a central version.
How to prevent it
- Add a
PackageVersionwhenever you add a newPackageReferenceunder CPM. - Keep
Directory.Packages.propsat the repo root so it covers all projects. - Review the props file in PRs that introduce new dependencies.