带有ADAL的.Net Core 1.1:无法解析依赖关系NetStandard.Library> = 1.6.0

时间:2016-11-23 12:31:04

标签: .net-core adal

我正在尝试在我的NetCore 1.1项目中使用ActiveDirectory客户端。项目恢复正常,但不构建。构建时,我收到错误The dependency NetStandard.Library >= 1.6.0 could not be resolved,指向Microsoft.IdentityModel.Clients.ActiveDirectory

为什么不能满足这种依赖性?从NetCore 1.0.1

升级之前,库曾经工作过

这是我的project.json(其中包含许多试图解决问题的额外内容):

{

  "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
    "Microsoft.IdentityModel.Clients.ActiveDirectory": "3.13.7",
    "NETStandard.Library": "1.6.1",
    "Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.AspNetCore.Localization": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.Tools.DotNet": {
      "version": "1.1.0-preview4-final",
      "imports": [
        "portable-net45+win8"
      ]
    },
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.Extensions.Localization": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "Microsoft.AspNetCore.Session": "1.1.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Core": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Utils": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Templating": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration": "1.1.0-preview4-final"
  },

  "tools": {
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.1.0-preview4-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }

  },
  "runtimes": {
    "win10-x64": {},
    "win8-x64": {},
    "win7-x64": {}
  },
  "frameworks": {

    "netcoreapp1.1": {
      "type": "platform",
      "version": "1.0.1",

      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }

  },

  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },


}

2 个答案:

答案 0 :(得分:1)

我也能够重现这个问题。看来这个包没有正确部署到Nuget。

当我在Microsoft.IdentityModel.Clients.ActiveDirectory.nuspec文件中注释以下行时,可以解决此问题:

<!--<dependency id="NetStandard.Library" version="1.6.0" />-->

但是,使用此版本包时仍然会出现异常。我也想提交这个问题。

作为一种解决方法,您可以将此软件包降级到版本3.13.6,这对我来说非常有用。

答案 1 :(得分:1)

显然更改了#34; NetStandard&#34;的名称大小写。在nuspec文件中&#34; NETStandard&#34;也可以解决它。

  

&#34; ADAL 3.13.7要求&#34; NetStandard&#34;库和应用程序   常见的导入,应用程序reuiqres NETStandard,即一个外壳   。问题&#34;

     

因此,此处的修复是使用正确的大小写更新adal的nuspec,即NETStandard。

请参阅此处的讨论:https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/559#issuecomment-261768339