Where to find System.DirectoryServices in ASP.NET Core 2.0?

I need to run multiple Active Directory queries using the new ASP.NET Core 2.0 web application. The Microsoft documentation says that System.DirectoryServices.AccountManagement libraries are available as part of .NET Core 2.0.

How to find related packages in NuGet that include this namespace? The only thing I see in NuGet is an unsupported library by someone other than Microsoft.

+9
source share
6 answers

I have a better solution for this topic. I found a Nuget package (it's in Pre-Release) called "Microsoft.Windows.Compatibility" that provides the System.DirectoryServices namespace you are looking for. Just find Nuget, make sure you have the pre-release option set, and you will find it. Most of them will work as soon as you receive it. Just remember to update the package later when it is complete. Hope, which helps someone, spent a couple of weeks tracking her.

+8
source

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 
0
source

I added Microsoft.Windows.Compatibility and the TFS 2018 build server failed to build: TFS 2018 build fails with Core 2.1 and the Microsoft.Windows.Compatibility 2.0.1 Nuget package, it looks like the compiler does not add the assembly or does not know where it is during the assembly process.

0
source

As I can see, now in NetCore 2.2 there is support for this package:

System.DirectoryServices.AccountManagement

You can find it in nuget.

Author of Microsoft and

Publication Date: Tuesday May 29, 2018 (May 29, 2008)

0
source

There is a preliminary version of System.DirectoryServices. You can get it from the NuGet package manager with this command:

System.DirectoryServices -Version 4.5.0-preview1-25914-04 installation package

This is working fine for me so far.

0
source

Source: https://habr.com/ru/post/1271127/


All Articles