[英].net core System.DirectoryServices not available?
I'm creating a project targetting dotnetcore 2.0. 我正在创建一个针对dotnetcore 2.0的项目。
According to the MSDN, System.DirectoryServices.ActiveDirectory should be usable in .net core 2.0 but I get an error that it can't find DirectoryServices under System. 根据MSDN,System.DirectoryServices.ActiveDirectory应该可以在.net core 2.0中使用,但是我收到一个错误,它在System下找不到DirectoryServices。
The method I need is GetComputerDomain() 我需要的方法是GetComputerDomain()
Is their an alternative for .net core 2.0? 他们是.net core 2.0的替代品吗?
I'm looking for an alternative to 我正在寻找替代方案
using System.DirectoryServices.ActiveDirectory
var domain = Domain.GetComputerDomain();
?? ??
WOuld like to be able to get the domain on windows and linux machines. WOuld喜欢能够在Windows和Linux机器上获得域名。
You need to refer System.DirectoryServices manually in your project. 您需要在项目中手动引用System.DirectoryServices 。
Here is the MSDN link about managing references . 以下是有关管理引用的MSDN链接。
System.DirectoryServices is now available in .net core 2.1; System.DirectoryServices现在可用于.net core 2.1; however, it works fine in Windows, but not in Linux (throws PlatformNotSupportedException, not sure whether it's an expected behavior).
但是,它在Windows中运行良好,但在Linux中运行不正确(抛出PlatformNotSupportedException,不确定它是否是预期的行为)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.