0

I try to use IPrincipal in dnxcore50. Although it works fine on Windows, I get the following error when running dotnet restore on OS X:

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

My project.json looks like this:

{
  "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. 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.

Ramon de Klein
  • 5,172
  • 2
  • 41
  • 64
  • Made any progress after asking this question? – Danny van der Kraan Apr 18 '16 at 08:56
  • To be honest... I gave up on CoreCLR until things are a bit more stabilized. Currently, it's a big mess due to incompatible versions and different toolchains. That's a shame, because the idea for CoreCLR is great, but the current implementation and version issues made me bail out... – Ramon de Klein Apr 18 '16 at 13:51

1 Answers1

1

You shouldn't use IPrincipal anymore for dnxcore50 projects, but rather derive from ClaimsPrincipal. You can learn more about this here: https://player.vimeo.com/video/154041158

Danny van der Kraan
  • 5,344
  • 6
  • 31
  • 41