Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the right way to fix error NU1605: Detected package downgrade - log4net

Tags:

.net-core

You do as follows:

dotnet new console dotnet add-package log4net --version 2.0.8 dotnet publish -r win10-x64 

And then you get:

error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. 

You can fix it adding the following to your csproj under PropertyGroup

<NoWarn>$(NoWarn);NU1605</NoWarn> 

But I'd like to understand the right way to get this fixed.

like image 440
pablo Avatar asked Dec 08 '17 10:12

pablo


2 Answers

Unfortunately, there's no other option than the package owner to upgrade their references or you adding the clausule in the csproj. Please see this GitHub issue for more information: https://github.com/dotnet/core/issues/907

like image 61
koelkastfilosoof Avatar answered Sep 26 '22 06:09

koelkastfilosoof


According to Microsoft, this can be resolved by adding the following to your csproj.

<PackageReference Include="Microsoft.NETCore.Targets" Version="3.0.0" PrivateAssets="all" />

https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1605#issue-1

"Certain combinations of packages which shipped with .NET Core 1.0 and 1.1 are not compatible with each other when they are referenced together in a .NET Core 3.0 or higher project, and a RuntimeIdentifier is specified. The problematic packages generally start with System. or Microsoft., and have version numbers between 4.0.0 and 4.3.1. In this case, the downgrade message will have a package starting with runtime. in the dependency chain."

like image 45
Dan Burgener Avatar answered Sep 22 '22 06:09

Dan Burgener