Skip to content
Latchkey

NuGet "Detected package downgrade" (NU1605) - Fix in CI

NuGet found that a transitive dependency requires a higher version of a package than your project resolves to. It calls this a downgrade and, under TreatWarningsAsErrors or for project references, fails the build.

What this error means

Restore or build stops with NU1605 showing a chain like "A 1.0 -> B 2.0 but the project pins B 1.0". It is deterministic and tied to the exact versions in your graph.

dotnet restore output
error NU1605: Detected package downgrade: Newtonsoft.Json from 13.0.3 to 12.0.3.
 Reference the package directly from the project to select a different version.
 MyApp -> SomeLib 4.1.0 -> Newtonsoft.Json (>= 13.0.3)
 MyApp -> Newtonsoft.Json (>= 12.0.3)

Common causes

A direct reference pins a lower version than a transitive one

Your project references a package at an older version, while a dependency of a dependency requires a newer one. NuGet refuses to silently downgrade the transitive requirement.

Inconsistent versions across projects in the solution

Two projects pin different versions of the same package; the one feeding into the other forces a downgrade in the consuming project.

How to fix it

Pin the package directly at the higher version

Add a direct PackageReference at or above the version the transitive chain demands.

.csproj
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

Centralize versions across the solution

Use central package management so every project resolves the same version and downgrades cannot creep in.

Directory.Packages.props
<!-- Directory.Packages.props -->
<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
  </ItemGroup>
</Project>

Inspect the full dependency graph

  1. Run dotnet list package --include-transitive to see resolved versions.
  2. Trace the chain in the NU1605 message to find what pulls the higher version.
  3. Align your direct reference to that version rather than suppressing the warning.

How to prevent it

  • Adopt central package management (Directory.Packages.props) for multi-project solutions.
  • Keep shared packages at a single version across all projects.
  • Review dotnet list package --include-transitive when bumping dependencies.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →