微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

在我的解决方案的Update-Package运行之后,我的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

值得注意的是,在运行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"
  }
}

解决方法

您的project.json对我来说很好,除非您的BusinessEntities,Ioc或WebApiCommon包引用了您收到警告的旧版本软件包.由于我无法看到这些包的依赖关系列表,我无法确定.

如果这些包不是警告的来源,那么我的猜测是你关于重启Visual Studio的答案就行了.对于我来说,Visual Studio与当前的软件包错误或警告集失去同步是很常见的.

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐