我正在将项目从 .Net Framework 移植到 .Net Standard。它广泛使用 SecurityIdentifier
类来表示身份和验证标识符。我已经得到要编译的代码,它在 Windows 上运行良好,但是当我在 Linux 上运行 .Net Core 时,SecurityIdentifier(String)
构造函数抛出一个 PlatformNotSupportedException
。我检查 the source果然它使用导入的 native 函数来解析。这不是一个破坏交易的因素,因为我看到 SecurityIdentifier(byte[], int)
构造函数不依赖于平台功能,并且解析 sid 也不是太难。但是当我在 Linux 上运行它时,我很惊讶地看到构造函数抛出相同的 PlatformNotSupportedException
!
有人在 Linux 上成功使用过这个类吗?您使用的是什么版本的 .Net Core?为什么链接中的源代码与我看到的不匹配?
最佳答案
当 Microsoft announced the Windows Compatibility Pack for .NET Core ,很明显,与 System.DirectoryServices
相关的任何内容都仅限于 Windows。如果您从未订阅过此类新闻 channel ,现在就应该订阅。
还有.NET API Analyzer提前告知此类情况。
关于c# - .Net Core Linux 不支持 SecurityIdentifier?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58868724/