0

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

无法解析 DNXCore 的 System.Security.Principal (>= 4.0.1-rc3-23829),Version=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 列为依赖项,而仅将“旧”.NET 框架列出。

4

1 回答 1

1

您不应再将 IPrincipal 用于 dnxcore50 项目,而应从 ClaimsPrincipal 派生。您可以在此处了解更多信息:https ://player.vimeo.com/video/154041158

于 2016-03-30T07:45:18.770 回答