I have projects in my solution that have the following package reference:
<PackageReference Include="System.Text.Json" />
My Directory.Packages.props contains:
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.19" />
<PackageVersion Include="System.Text.Json" Version="8.0.6" />
These are the latest versions available for .NET 8.
The settings:
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
But I am getting the following build error on each project:
Warning As Error: Detected package downgrade: System.Text.Json from 9.0.0 to 8.0.6. Reference the package directly from the project to select a different version.
MyProject -> Microsoft.Extensions.Hosting 9.0.0 -> Microsoft.Extensions.Configuration.Json 9.0.0 -> System.Text.Json (>= 9.0.0)
MyProject -> System.Text.Json (>= 8.0.6)
When I set CentralPackageTransitivePinningEnabled to true, the only project that does not need to reference Microsoft.Extensions.Hosting throws the error on build.
I can’t pinpoint the problem as I am not reference .NET 9 and I want to stick with .NET 8 for now. What am I missing?