.Net Core 1.1 with ADAL: The dependency NetStandard.Library >= 1.6.0 could not be resolved

萝らか妹 提交于 2019-12-12 03:53:37

问题


I'm trying to use ActiveDirectory client on my NetCore 1.1 project. Project restores fine, but doesn't build. When building I get an error The dependency NetStandard.Library >= 1.6.0 could not be resolved that points to Microsoft.IdentityModel.Clients.ActiveDirectory

Why can't this dependency be satisfied? Library used to work before upgrading from NetCore 1.0.1

Here is my project.json (which contains lot's of extra stuff trying to resolve the problem):

{

  "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%" ]
  },


}

回答1:


I am able to reproduce this issue too. It seems that this package is not deploy properly to Nuget.

The issue could be fixed when I comment the line below in Microsoft.IdentityModel.Clients.ActiveDirectory.nuspec file:

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

However, I still get the exception when use this version package. I also am trying to submit this issue.

As a workaround, you can downgrade this package to version 3.13.6 which works well for me.




回答2:


Apparently changing the casing of the name for "NetStandard" in the nuspec file to "NETStandard" can fix it as well.

"ADAL 3.13.7 requires "NetStandard" library and in the applications common import, the application reuiqres NETStandard, i.e. a casing issue."

So the fix here is to update the adal's nuspec with correct casing i.e. NETStandard.

See discussion here: https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/559#issuecomment-261768339



来源:https://stackoverflow.com/questions/40764658/net-core-1-1-with-adal-the-dependency-netstandard-library-1-6-0-could-not-b

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!