在dnxcore50中找不到IPrincipal

时间:2016-03-29 18:58:08

标签: dnx iprincipal project.json

我尝试在dnxcore50中使用IPrincipal。虽然它在Windows上运行良好,但在OS X上运行dotnet restore时出现以下错误:

  

无法解析System.Security.Principal(> = 4.0.1-rc3-23829)   对于DNXCore,版本= v5.0(osx.10.11-x64)。

我的project.json看起来像这样:

{
  "version": "0.1.3-*",

  "compilationOptions": {
    "emitEntryPoint": false
  },  

  "compile": "*.cs",
  "exclude": "Platform/**/*.cs",

  "frameworks": {
    "net45": {
      "include": "Platform/DotNet45/*.cs",
      "frameworkAssemblies": {
        "System.Xml": "4.0.0.0",
        "System.Xml.Linq": "4.0.0.0",
        "System.Xml.XDocument": "4.0.0.0"
      }   
    },  
    "dnxcore50": {
      "include": "Platform/DotNetCore/*.cs",
      "dependencies": {
        "NETStandard.Library": "1.0.0-rc3-23829",
        "System.Security.Principal": "4.0.1-beta-23516",
        "System.Security.Cryptography.Hashing.Algorithms": "4.0.0-beta-23225",
        "System.Security.Cryptography.X509Certificates": "4.0.0-rc3-23829",
        "System.Xml.XDocument": "4.0.11-rc3-23829",
        "System.Xml.XmlSerializer": "4.0.11-rc3-23829"
      }   
    }   
  }
}

似乎System.Security.Principal仅在Windows平台上可用,但IPrincipal的概念似乎也非常通用。 NuGet页面(https://www.nuget.org/packages/System.Security.Principal/4.0.1-beta-23516)也没有将dnxcore50列为依赖项,但只列出了" old" .NET框架。

1 个答案:

答案 0 :(得分:1)

您不应再对dnxcore50项目使用IPrincipal,而应从ClaimsPrincipal派生。您可以在此处了解详情:https://player.vimeo.com/video/154041158