【问题标题】:What is the source of these ASP.NET Core dependency warnings?这些 ASP.NET Core 依赖警告的来源是什么?
【发布时间】:2017-08-03 16:47:37
【问题描述】:

在我的解决方案运行 Update-Package 之后,我的 ASP.Net Core 项目中出现如下所示模式的警告。

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

图案:

依赖冲突。 [项目名称] [项目版本] 预期 [依赖名称] >= [注册版本] 但收到 [较低版本]

指定的依赖项是 [依赖项名称] >= [注册版本] 但以 [依赖项名称] [较低版本] 结束

示例:我对依赖项 Microsoft.Extensions.Logging v1.1.1 有此警告:

依赖冲突。 Statistics 1.0.0 预期 Microsoft.Extensions.Logging >= 1.1.1 但收到 1.1.0

指定的依赖项是 Microsoft.Extensions.Logging >= 1.1.1 但最终使用 Microsoft.Extensions.Logging 1.1.0

应该注意的是,在运行 Update-Packages cmdlet 之前,project.json 文件确实引用了 Microsoft.Extensions.Logging 的 v1.1.0。

更新后的 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"
  }
}

【问题讨论】:

    标签: .net asp.net-core dependencies .net-core project.json


    【解决方案1】:

    您的 project.json 对我来说看起来不错,除非您的 BusinessEntitiesIocWebApiCommon 软件包引用了您收到警告的旧版本软件包。因为我看不到这些包的依赖列表,所以我不能确定。

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

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

    【讨论】:

    • 谢谢!下次出现此问题时,我会确保这样做(即:使用命令行)。
    【解决方案2】:

    编辑:上面显示的项目结构似乎不相关,因为 project.json 文件已被更“传统”的 xml 样式 .csproj 文件替换。

    【讨论】:

      猜你喜欢
      • 2020-05-28
      • 2011-03-07
      • 1970-01-01
      • 2012-04-17
      • 2013-06-25
      • 1970-01-01
      • 2016-08-25
      • 2021-05-03
      相关资源
      最近更新 更多