Edit

Share via


NuGet Error NU1109

NU1109: Detected package downgrade: PackageB from 2.0.0 to centrally defined 1.0.0. Update the centrally managed package version to a higher version.
  'Project' -> 'PackageA' 1.0.0 -> 'PackageB' (>= 2.0.0)
  'Project' -> 'PackageB' (>= 1.0.0)

Issue

A project is configured to use NuGet Central Package Management and a transitive package dependency is pinned to a version lower than is specified by the dependency package. When resolving packages, NuGet respects the direct-dependency-wins rule and the pinned package version overrides the version specified by the dependency package which results in a lower version of the package being resolved which could result in issues at runtime.

<PropertyGroup>
  <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
  <PackageVersion Include="PackageA" Version="1.0.0" />
  <PackageVersion Include="PackageB" Version="1.0.0" />
</ItemGroup>

Solution

  • Update the PackageVersion of PackageB to the higher version of the package.
<ItemGroup>
  <PackageVersion Include="PackageB" Version="2.0.0" />
</ItemGroup>
  • Disable Central Package Management transitive pinning to allow the package version specified by the dependency package to be used.
<PropertyGroup>
  <CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>