Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detected package downgrade: Microsoft.NETCore.App from 2.1.3 to 2.1.0

I try to update my .net solution from .NET Core 1.1 to .NET Core 2.1. I have several .NET Core and .NET standard projects inside, which reference each other and another NuGet packages. After update 'dotnet resore' and 'dotnet build' commands work fine, but when i try to build my solution from visual studio, i get this error:

Error NU1605 Detected package downgrade: Microsoft.NETCore.App from 2.1.3 to 2.1.0. Reference the package directly from the project to select a different version.

And i see that indeed some of my projects have SDK reference to Microsoft.NETCore.App v2.1.0 and some of them v.2.1.3. Setting RuntimeFrameworkVersion and adding this package to dependencies explicitly doesn't work.

How i can deal with this?

UPD: dotnet --info:

.NET Core SDK (reflecting any global.json):  Version:   2.1.401  Commit:    91b1c13032  Runtime Environment:  OS Name:     Windows  OS Version:  10.0.17134  OS Platform: Windows  RID:         win10-x64  Base Path:   C:\Program Files\dotnet\sdk\2.1.401\  Host (useful for support):   Version: 2.1.3   Commit:  124038c13e  .NET Core SDKs installed:   1.1.10 [C:\Program Files\dotnet\sdk]   2.0.0 [C:\Program Files\dotnet\sdk]   2.1.4 [C:\Program Files\dotnet\sdk]   2.1.100 [C:\Program Files\dotnet\sdk]   2.1.202 [C:\Program Files\dotnet\sdk]   2.1.400 [C:\Program Files\dotnet\sdk]   2.1.401 [C:\Program Files\dotnet\sdk]  .NET Core runtimes installed:   Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]   Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]   Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]   Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]   Microsoft.NETCore.App 1.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 1.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]   Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]  To install additional .NET Core runtimes or SDKs:   https://aka.ms/dotnet-download 

UPD: Somehow issue disappears if i remove this line from .csproj file:

<RuntimeIdentifier>win7-x64</RuntimeIdentifier>

Can it be related?

like image 994
ant Avatar asked Aug 28 '18 19:08

ant


Video Answer


2 Answers

I had a similar issue to you. Could not publish my project when I specified a runtime identifier.

The solution I got to work was to add in the following line to the *.csproj

<PropertyGroup>          <TargetFramework> xxx </TargetFramework>          <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>  <<<----- Add this line   </PropertyGroup> 

After that line was added the project would publish correctly.

The below link references a downgrade issue between 2.1.1 and 2.1.0 but the solution worked the same.

https://github.com/dotnet/cli/issues/9624

like image 78
Soul3lade Avatar answered Sep 25 '22 12:09

Soul3lade


I had a missing version in the csproj file.

Adding the version fixed the issue.

enter image description here

like image 45
h-rai Avatar answered Sep 22 '22 12:09

h-rai