System.DirectoryServices is not support dot net core 3.1 version on linux container.

nandkishor ingavale 1 Reputation point
2021-06-16T10:31:48.157+00:00

I'm trying to put a .NET Core 3.1 application listing users in an AD group into a .NET Core Runtime Docker container. Accessing the AD is being done with the help of a DirectorySearcher from the System.DirectoryServices namespace. Out of the box, .NET Core doesn't support this namespace, but by adding the package System.DirectoryServices (dotnet add package System.DirectoryServices) installed the required assemblies and the application runs fine on a Win10 machine.

Trying to let the app run in a Linux .Net Core Runtime container throws an exception because DirectoryServices doesn't support this platform

Is it support latest dot net version?

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,154 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Xingyu Zhao-MSFT 5,366 Reputation points
    2021-07-21T01:48:03.27+00:00

    Hi @nandkishor ingavale ,

    In .NET5, System.DirectoryServices.Protocols is support in linux, so try to change your framework to .NET5.
    See:
    Announcing .NET 5.0 Preview 5

    116514-screenshot-2021-07-19-101259.png
    Hope it could be helpful.

    Best Regards,
    Xingyu Zhao
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Lex Li (Microsoft) 5,582 Reputation points Microsoft Employee
    2021-06-16T14:46:14.873+00:00

    Only System.DirectoryServices.Protocols can be used on non-Windows platforms, as announced years ago.

    You can also search for third party solutions if there exists any.

    0 comments No comments

  3. Bruce (SqlWork.com) 64,651 Reputation points
    2023-01-19T16:51:29.2966667+00:00

    as 3.1 is out of support, I'd upgrade to .net 6 and System.DirectoryServices.Protocols. but the standard solution for 3.1 is ldap:

    [https://github.com/dsbenghe/Novell.Directory.Ldap.NETStandard

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.