Detected package downgrade warning (dotnet core, v

2019-03-11 14:29发布

I have just updated all my nuget packages for my solution (dotnet core 1.1 project).

I am now getting the following warnings and I don't really know what they mean.

NETStandard.Library downgrade warning


Update: I am still getting warnings mentioned above. My web projects warn about the Microsoft.NETCore.App package (see screenshot below) and my lib projects warn about NETStandard.Library (see screenshot above)

Microsoft.NETCore.App downgrade warning

When trying to update Microsoft.NETCore.App in the NuGet package manager, I am getting the following error:

NuGet upgrade error

Hope someone can help me get rid of those warnings and setup everything it is meant to be, so I can update all my packages.

Thanks in advance!

14条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-03-11 15:10

I was able to get rid of these warnings in my project by removing the <NetStandardImplicitPackageVersion> element from the csproj file.

There's some information in this article about implicit metapackages, which seems to be the root cause of this problem.

You might also need to update some dependencies. For example, I had to upgrade BenchmarkDotNet from 0.10.1 to 0.10.3 to get rid of a few warnings like the ones you're seeing.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-11 15:12

This situation occurred to me after opening an existing solution but instead of Warnings, they were Errors.

I opened the YourAwesomeApp.csproj file and went through the "Detected package downgrade" errors one-by-one and manually changed the version of that line item from the existing version to the specified version that was shown in the error itself.

For example, if the Error says downgrade detected "SqlServer 1.0.4 -> 1.0.3" then find the line for package SqlServer and edit the version from 1.0.3 to 1.0.4.

Those errors should disappear after building the project.

The downside to this that I only had 5 errors this time but what if another person's project contained say 50 such errors. Then that person's task of manually editing those lines would be very tedious and time-consuming.

查看更多
ら.Afraid
4楼-- · 2019-03-11 15:16

I solved this issue thanks to this answer. Basically, just add the following line inside the <PropertyGroup> tags in your .csproj file:

<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
查看更多
欢心
5楼-- · 2019-03-11 15:17

In my case, this error was not related to .NET Core but to .NET Standard.

I had two libraries A, and B. Library A depended on some nuget package X, and library B depended on A. Once I upgraded X to a new version, somehow it started depending on a new version of NETStandard.Library nuget package (from 2.0.2 to 2.0.3), which broke the build of B with the error Detected package downgrade: NETStandard.Library from 2.0.3 to 2.0.2. Reference the package directly from the project to select a different version.

Once I added the NETStandard.Library nuget package as a dependency to B (obviously targetting the latest version 2.0.3), the error went away, even if a new warning appeared:

/usr/local/share/dotnet/sdk/2.1.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets(5,5): Warning NETSDK1023: A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs (NETSDK1023) (GWallet.Frontend.XF)

查看更多
Bombasti
6楼-- · 2019-03-11 15:21

I could solve the problem by downloading earlier version of the package causing the problem, that seems to be caused by depending on a .NET Standard version that's not installed, this also should be solved by updating Visual Studio.

查看更多
贼婆χ
7楼-- · 2019-03-11 15:22

In my case neither of those properties were set in my csproj files.

I had to tell VS to update those packages via NuGet.

The warnings appeared for me after resolving the warning for explicit reference to implicit dependency .NETCore.App after moving from 1.0 to 1.1.

UPDATE 21/09/17

This also seems to affect upgrades to 2.0, the resolution is the same. Update those packages manually with NuGet. Thanks to IbrarMumtaz for pointing this out!

查看更多
登录 后发表回答