简体   繁体   English

在dnxcore50中找不到IPrincipal

[英]IPrincipal cannot be found in dnxcore50

I try to use IPrincipal in dnxcore50. 我尝试在dnxcore50中使用IPrincipal。 Although it works fine on Windows, I get the following error when running dotnet restore on OS X: 尽管在Windows上可以正常工作,但在OS X上运行dotnet restore时出现以下错误:

Unable to resolve System.Security.Principal (>= 4.0.1-rc3-23829) for DNXCore,Version=v5.0 (osx.10.11-x64). 无法解析DNXCore,Version = v5.0(osx.10.11-x64)的System.Security.Principal(> = 4.0.1-rc3-23829)。

My project.json looks like this: 我的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"
      }   
    }   
  }
}

It seems that System.Security.Principal is only available on the Windows platform, but the concept of IPrincipal seems pretty generic too me. 似乎System.Security.Principal仅在Windows平台上可用,但IPrincipal的概念似乎也很通用。 The NuGet page ( https://www.nuget.org/packages/System.Security.Principal/4.0.1-beta-23516 ) also doesn't list dnxcore50 as a dependency, but only the "old" .NET frameworks. NuGet页面( https://www.nuget.org/packages/System.Security.Principal/4.0.1-beta-23516 )也不列出dnxcore50作为依赖项,而仅列出了“旧的” .NET框架。

You shouldn't use IPrincipal anymore for dnxcore50 projects, but rather derive from ClaimsPrincipal. 您不应再将IPrincipal用于dnxcore50项目,而应从ClaimsPrincipal派生。 You can learn more about this here: https://player.vimeo.com/video/154041158 您可以在此处了解更多信息: https : //player.vimeo.com/video/154041158

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM