我尝试在 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 框架列出。