dotnet cli - “detected package downgrade”

2019-06-15 03:05发布

问题:

I have finally managed to get a project's dependencies downloaded with dotnet restore, after going through the process of clearing all nuget cache, dnx cache, and updating the cli using the beta channel.

But using the project.json below, I get an error;

warn : Detected package downgrade: Microsoft.Dnx.Compilation.CSharp.Abstractions from 1.0.0-rc2-16553 to 1.0.0-rc2-16552

I'm not sure what this means, or how to fix it. The things still download, but this concerns me.

I am using the following;

dotnet/cli

.NET Command Line Tools (1.0.0-beta-001540)

Product Information:
 Version:     1.0.0-beta-001540
 Commit Sha:  6aeed1f52d

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 Runtime Id:  win10-x64

dnvm list

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-rc1-update1 clr     x64          win
       1.0.0-rc1-update1 clr     x86          win
       1.0.0-rc1-update1 coreclr x64          win
       1.0.0-rc1-update1 coreclr x86          win
       1.0.0-rc2-16551   clr     x86          win
  *    1.0.0-rc2-16551   coreclr x64          win             default
       1.0.0-rc2-16551   coreclr x86          win

nuget.config

<packageSources>
    <add key="aspnet-core" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>

project.json

{
    "webroot": "wwwroot",
    "version": "1.0.0-*",
    "dependencies": {
        "Microsoft.NETCore.Platforms": "1.0.1-*",
        "Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
        "Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
        "Microsoft.AspNetCore.Mvc": "1.0.0-*",
        "Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-*",
        "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
        "Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
        "Microsoft.Extensions.Configuration.Json": "1.0.0-*",
        "Microsoft.Extensions.Logging.Console": "1.0.0-*",
        "Microsoft.AspNetCore.Identity": "1.0.0-*",
    },
    "frameworks": {
        "dnx451": {
            "dependencies": {
                "Microsoft.AspNetCore.Mvc.Dnx": "1.0.0-*"
            }
        },
        "net451": { },
        "dnxcore50": {
            "imports": "portable-net451+win7+win8",
            "dependencies": {
                "NETStandard.Library": "1.0.0-*"
            }
        }
    },

    "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
    ],
    "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
    ]
}

回答1:

One of the libraries explicitly require 1.0.0-rc2-16552 version, that's why you get the warning. Once the library u[grade to supports higher version warnings will disappear. This is an old post so not sure which library is doing this at the time of your post, but for people with same warning, go through your libraries and look which one has version dependency. Basically, remove the library or stay on downgraded version until the library updates and supports the new version.