error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Logging from 10.0.0 to 9.0.0. means your project references an older version of a package than another of your packages needs. NuGet will not quietly hand that package an older version than it asked for, and the .NET SDK treats this warning as an error.

Raise your direct reference to the version the error names first (here 10.0.0), or remove the direct reference and let the package come in through the dependency. The two lines under the error show both paths.

The error

...\DgLab\DgLab.csproj : error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Logging from 10.0.0 to 9.0.0. Reference the package directly from the project to select a different version.
...\DgLab\DgLab.csproj : error NU1605:  DgLab -> Microsoft.Extensions.Logging.Console 10.0.0 -> Microsoft.Extensions.Logging (>= 10.0.0)
...\DgLab\DgLab.csproj : error NU1605:  DgLab -> Microsoft.Extensions.Logging (>= 9.0.0)

The project file behind it:

<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />

Why it happens

Microsoft.Extensions.Logging.Console 10.0.0 declares that it needs Microsoft.Extensions.Logging 10.0.0 or later. Your project also references Microsoft.Extensions.Logging directly, at 9.0.0, and a direct reference wins. Taken at its word, the console logger would run against an older library than it was built for, so NuGet reports a downgrade. The message prints "Warning As Error" because the SDK raises NU1605 to an error by default; the project in this test set nothing to make it so.

Upgrading some packages of a family and not others builds exactly this graph, and so does dotnet add package run with an older --version. That command printed the same three errors, still wrote the 9.0.0 reference into the project file and exited with code 0, so the failure only shows on the next build.

The fix

dotnet add package Microsoft.Extensions.Logging --version 10.0.0

The build then succeeded with no warnings. To see where a package enters the graph, ask NuGet:

Project 'DgLab' has the following dependency graph(s) for
'Microsoft.Extensions.Logging':

  [net10.0]
  ├── Microsoft.Extensions.Logging (v10.0.0)
  └── Microsoft.Extensions.Logging.Console (v10.0.0)
      ├── Microsoft.Extensions.Logging (v10.0.0)
      └── Microsoft.Extensions.Logging.Configuration (v10.0.0)
          └── Microsoft.Extensions.Logging (v10.0.0)

That is dotnet nuget why Microsoft.Extensions.Logging after the fix. Run before the fix, it listed the same tree with v9.0.0 on every node: it shows the version NuGet resolved, not the version each parent asked for, so for a downgrade the error's own lines are the better map.

The second fix also worked: dotnet remove package Microsoft.Extensions.Logging left only the console logger, which brought in 10.0.0 by itself, and the build succeeded. Keep the direct reference only if your code needs a newer version than the dependency asks for.

How it was reproduced

A console project (dotnet new console, net10.0) with Microsoft.Extensions.Logging.Console 10.0.0, then Microsoft.Extensions.Logging 9.0.0 added directly, on .NET SDK 10.0.403 (MSBuild 18.9.15) on Windows 11, packages from nuget.org. No TreatWarningsAsErrors or WarningsAsErrors was set in the project.

Frequently asked

Why is NU1605 an error when it says warning?
The .NET SDK treats NU1605 as an error by default, which is why the message reads Warning As Error. In the test the project set nothing to cause it; the downgrade alone failed the restore.
How do I fix Detected package downgrade in NuGet?
Raise the direct PackageReference to the version named first in the message, for example 10.0.0, or remove the direct reference so the package arrives through the dependency that needs the newer version.
What does dotnet nuget why show?
Every path through which a package enters your project, per target framework, with the version NuGet resolved. It does not show the version each parent requested, so read the NU1605 lines for that.

Another restore error with a similar look is NU1102, when the version does not exist: Unable to find package with version. More decoded errors in the Fixes category.