Reputation: 1999
I currently have the following packages in my .NET Core application.
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0-preview6.19307.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview5-19227-01" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.0.0-preview5-19227-01" />
I am trying to add some logging.
https://www.nuget.org/packages/Microsoft.Extensions.Logging.EventLog/3.0.0-preview6.19304.6
But when I try, I get the following error message...
Detected package downgrade: Microsoft.NETCore.Platforms from 3.0.0-preview6.19303.8 to 3.0.0-preview5.19224.8. Reference the package directly from the project to select a different version.
MyApp -> Microsoft.Extensions.Logging.EventLog 3.0.0-preview6.19304.6 -> System.Diagnostics.EventLog 4.6.0-preview6.19303.8 -> Microsoft.NETCore.Platforms (>= 3.0.0-preview6.19303.8)
MyApp -> Microsoft.NETCore.Platforms (>= 3.0.0-preview5.19224.8)
Can anyone please advise?
Upvotes: 0
Views: 144
Reputation: 239260
Simply, the error means that one or more of the package references actually already has a reference to one of your other package references. In this case, that almost certainly Microsoft.AspNetCore.Mvc.NewtonsoftJson
, where one or perhaps both of your other two references actually reference this package already. However, since they have a higher preview version, they're referencing a higher preview version of NewtonsoftJson
as well, and your explicit project reference to a lower preview version is causing a "downgrade".
The solution is simple: either 1) update your project reference to the latest, so that it matches with the internal reference in the other package(s) or 2) just remove the package reference entirely. If the package is already brought in as a dependency for another package, you can use it as well via the existing reference; you do not need to explicitly reference it yourself.
Upvotes: 2