11

I need to run some Active Directory queries with a new ASP.NET Core 2.0 web application. Microsoft's documentation says the System.DirectoryServices.AccountManagement libraries are available as part of .NET Core 2.0.

How do I find the associated packages in NuGet which include this namespace? The only one I see in NuGet is an unsupported library by someone other than Microsoft.

Vadim Ovchinnikov
  • 13,327
  • 5
  • 62
  • 90
bperniciaro
  • 901
  • 2
  • 12
  • 30

5 Answers5

9

I have a better solution for this thread. 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 search Nuget, make sure you have the Pre-Release option checked, and you will find it. Most everything will work once you get it. Just make sure to update the package later on, when it's finalized. Hope that helps someone, took me a couple weeks to track it down.

James Hodges
  • 91
  • 1
  • 1
8

Unfortunately, System.DirectoryServices are scheduled for .net core 2.1 not .net core 2.0.

https://github.com/dotnet/corefx/issues/2089 is the original issue log

Win
  • 61,100
  • 13
  • 102
  • 181
1

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

System.DirectoryServices.AccountManagement

You can find it in nuget.

Author is Microsoft and

Date Published: Tuesday, May 29, 2018 (5/29/2018)

cnom
  • 3,071
  • 4
  • 30
  • 60
0

With "Microsoft.Windows.Compatibility", it will compile but you'll get a platform not supported exception at runtime 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
Tim Graf
  • 11
  • 2
0

There is a pre-release version for System.DirectoryServices. You can get it from NuGet package manager using this command:

Install-Package System.DirectoryServices -Version 4.5.0-preview1-25914-04

This is working fine for me till now.

p4ulinux
  • 329
  • 5
  • 14