Edit

Share via


NuGet Error NU1009

The following PackageReference items are implicitly defined and cannot define a PackageVersion item: PackageName. Projects using Central Package Management require that implicit package versions be specified by the PackageReference item.

Issue

A project is configured to use NuGet Central Package Management and a <PackageVersion /> item is defined in the Directory.Packages.props file for a package that is implicitly defined. Implicitly defined packages are generally declared by an SDK to include packages on your behalf. For these packages, the owner of the SDK controls the version being used and a user should not define a version with Central Package Management.

<ItemGroup>
  <PackageReference Include="Microsoft.NETCore.App" Version="9.0.0" IsImplicitlyDefined="true" />
</ItemGroup>

Solution

  • Remove the PackageVersion item from the Directory.Packages.props file that corresponds to the implicitly defined package:

    <ItemGroup>
      <PackageVersion Include="Microsoft.NETCore.App" Version="1.0.0" />
    </ItemGroup>
    

Note

Some SDKs allow you to override the implicitly defined package version by setting a specific MSBuild property for that package and the SDK may have documentation on how to do so.