It will compile with "Microsoft.Windows.Compatibility", but you will get an exception that is not supported by the platform at run time if you are not running on Windows.
Unhandled Exception: System.PlatformNotSupportedException: System.DirectoryServices is not supported on this platform. at System.DirectoryServices.DirectoryEntry..ctor(String path) at ad_test.ActiveDirectoryClient.GetUsername(String emailAddress) in .../ad-test/ActiveDirectoryClient.cs:line 24 at ad_test.Program.Main(String[] args) in .../ad-test/Program.cs:line 11
source share