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.
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
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."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With