这些 ASP.NET 核心依赖警告的来源是什么?

What is the source of these ASP.NET Core dependency warnings?

在我的解决方案的更新包 运行 之后,我的 ASP.Net 核心项目出现了以下列出的模式的警告。

我无法确定此问题的根本原因。

模式:

Dependency Conflict. [project name] [project version] expected [dependency name] >= [registered version] but received [lower version]

Dependency specified was [dependency name] >= [registered version] but ended up with [dependency name] [lower version]

示例:我有关于依赖性的警告 Microsoft.Extensions.Logging v1.1.1:

Dependency Conflict. Statistics 1.0.0 expected Microsoft.Extensions.Logging >= 1.1.1 but received 1.1.0

Dependency specified was Microsoft.Extensions.Logging >= 1.1.1 but ended up with Microsoft.Extensions.Logging 1.1.0

可能需要注意的是,在 运行ning Update-Packages cmdlet 之前,project.json 文件确实引用了 Microsoft.Extensions.Logging.[=14= 的 v1.1.0 ]

Post-更新project.json文件:

{
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "xmlDoc": true,
    "nowarn": [ "CS1591" ]
  },
  "dependencies": {
    "BusinessEntities": "1.0.0-*",
    "IdentityServer4.AccessTokenValidation": "1.1.0",
    "Ioc": "1.0.0-*",
    "Microsoft.AspNet.WebApi.Client": "5.2.3",
    "Microsoft.AspNetCore.Diagnostics": "1.1.1",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.1",
    "Microsoft.AspNetCore.Mvc": "1.1.2",
    "Microsoft.AspNetCore.Routing": "1.1.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.1",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.1",
    "Microsoft.AspNetCore.Server.Kestrel.Https": "1.1.1",
    "Microsoft.Extensions.Configuration.CommandLine": "1.1.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.1",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.1",
    "Microsoft.Extensions.Configuration.Json": "1.1.1",
    "Microsoft.Extensions.Logging": "1.1.1",
    "Microsoft.Extensions.Logging.Console": "1.1.1",
    "Microsoft.Extensions.Logging.Debug": "1.1.1",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.1",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "Swashbuckle.AspNetCore": "1.0.0-rc1",
    "Swashbuckle.AspNetCore.Swagger": "1.0.0-rc1",
    "Swashbuckle.AspNetCore.SwaggerGen": "1.0.0-rc1",
    "Swashbuckle.AspNetCore.SwaggerUi": "1.0.0-rc1",
    "System.Xml.XmlDocument": "4.3.0",
    "Unity": "4.0.1",
    "WebApiCommon": "1.0.0-*"
  },
  "frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.1.1"
        }

      },
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },
  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },
  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.DotNet.Watcher.Tools": "1.1.0-preview4-final"
  }
}

编辑:上面显示的项目结构似乎不相关,因为 project.json 文件已被更 "traditional" xml 风格的 .csproj 文件取代。

我觉得你的project.json很好,除非你的BusinessEntitiesIocWebApiCommon包引用了您收到警告的软件包的旧版本。因为我看不到那些包的依赖列表,所以我不能确定。

如果这些包不是警告的来源,那么我的猜测是您关于重新启动 Visual Studio 的回答起到了作用。 Visual Studio 与当前的包错误或警告集不同步对我来说在 Beta 工具上很常见。

要完全排除 Visual Studio,请在项目文件夹内的命令行中执行 dotnet restoredotnet build。您可以将在那里看到的消息和错误视为权威来源。