【发布时间】:2019-10-15 09:32:29
【问题描述】:
我们正在调用一个 dotnet 标准 dll,它在 WindowsIdentity 上调用 GetCurrent。它在 dotnet 核心应用程序中运行良好,但是一旦将其导入 dotnet 框架(4.7.2)应用程序就会出现此错误:
System.PlatformNotSupportedException: 'Windows Principal functionality is not supported on this platform.'
尽管几个月前在 dotnet/standard github 问题论坛上提出了这个问题,但这个问题仍然存在: https://github.com/dotnet/standard/issues/1279
【问题讨论】:
-
所以这特别是当您针对 netstandard,但running 在net472 上?图书馆目前有双重目标吗?还是它仅以网络标准为目标?如果是后者:你能使它成为双重目标吗?即
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>(它听起来像一个具有传递依赖的诱饵和切换失败) -
感谢@MarcGravell - 主机应用程序针对的是 net472,库仅针对 netstandard。按照您的建议将其设置为双重目标效果很好,非常感谢:-) 请随意将此作为正确答案,我会将其标记为正确。
标签: .net .net-core .net-standard