Error NU1605 Detected package downgrade

前端 未结 3 1769
清酒与你
清酒与你 2021-02-11 12:07

I am experiencing the following NU1605 dependency errors in my netcoreapp2.0 console application:

NU1605  Detected package downgrade: System.Dia         


        
相关标签:
3条回答
  • 2021-02-11 12:35

    I had a similar issue with a .netcoreapp2.2 console application.

    The project was building successfully. However, publishing was failing with several NU1605 errors.

    The problem was originated from log4net version 2.0.8. It was referenced in a .netstandard2.0 project with the following dependencies:

    They were causing package downgrades in the projects referencing log4net. And during publish these warnings are treated as errors...

    To solve the problem I added correct versions of these libraries via Nuget.

    Finally, the publishing succeeded.

    P.S. When I first added packages with the newest version of libraries, a yellow warning sign was displayed on the dependencies list as if the packages were not suitable for that project. After unloading the project and loading back the warning sign gone! (I'm using Visual Studio 2019)

    Hope it helps!

    0 讨论(0)
  • 2021-02-11 12:43

    Just had the same issue (NU1605) with .Net core 3.1 and log4Net:

    error NU1605: Detected package downgrade: System.Net.NameResolution from 4.3.0 to 4.0.0.

    What I did is adding a Nuget reference to System.Net.NameResolution and install version 4.3.0, then I closed Visual Studio and re-opened the Solution.

    0 讨论(0)
  • 2021-02-11 12:49

    Error NU1605 Detected package downgrade

    For the error NU1605:

    You can use <NoWarn>NU1605</NoWarn> to clear the WarningsAsErrors in your project.

    That because netcoreapp2.0 projects have <WarningsAsErrors>NU1605</WarningsAsErrors> by default. Check it from Properties->Build->Treat warning as errors:

    Add like following:

    <PackageReference Include="Colorful.Console" Version="1.2.6">
          <NoWarn>NU1605</NoWarn>
    </PackageReference>
    

    Check the blog post here: MSBuild integration of NuGet warnings and errors and Unexpected package version warnings.

    For the error NU1603:

    The warning occurs because System.Runtime.Handles (>= 4.1.0) does not exist in the feed. Typically this is a package authoring error because the package depends on something that doesn't exist.

    You can also use <NoWarn>NU1603</NoWarn> to resolve this issue:

    <PropertyGroup>
          <NoWarn>NU1603</NoWarn>
    </PropertyGroup>
    

    Note:You would notice that your project has another warning, notice the yellow triangle insignia on the PackageReference DotSpinners on Reference. That because the package DotSpinners is a .NET Framework project, not compatible with your .NET Core project.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题