NuGet "error NU1605: Detected package downgrade" in CI
A transitive dependency in your graph requires a higher version of a package than a direct reference (or another path) pins. NuGet treats a forced downgrade as an error and names both ends of the conflict.
What this error means
dotnet restore fails with "error NU1605: Detected package downgrade: X from 8.0.0 to 6.0.0" and shows the two dependency paths that disagree.
error NU1605: Detected package downgrade: System.Text.Json from 8.0.0 to 6.0.0.
MyApp -> Some.Lib 4.0.0 -> System.Text.Json (>= 8.0.0)
MyApp -> System.Text.Json (>= 6.0.0)Common causes
A direct reference pins a lower version than a transitive one needs
Your project references the package at 6.0.0 directly, but a dependency requires 8.0.0; resolving to 6.0.0 would be a downgrade.
A stale pin after upgrading another dependency
You bumped a library whose transitive requirement rose, but left an old direct pin behind.
How to fix it
Raise the direct reference to the required version
- Read the two paths NU1605 prints and note the higher required version.
- Update the direct
PackageReferenceto at least that version. - Re-run
dotnet restoreto confirm the downgrade is gone.
<PackageReference Include="System.Text.Json" Version="8.0.0" />Use central package management to pin once
Set the version in one Directory.Packages.props so every project agrees and no path forces a downgrade.
<ItemGroup>
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
</ItemGroup>How to prevent it
- Pin shared packages at or above the highest transitive requirement.
- Adopt central package management so versions stay consistent.
- Re-restore after every dependency bump to catch downgrades early.