System.DirectoryServices.AccountManagement is not supported on this platform

752 views Asked by At

I get this exception when debugging:

System.DirectoryServices.AccountManagement is not supported on this platform.

and call stack starts as:

System.DirectoryServices.AccountManagement.PrincipalContext.PrincipalContext(System.DirectoryServices.AccountManagement.ContextType) in System.DirectoryServices.AccountManagement.notsupported.cs

I am running on Windows, I am targeting:

<TargetFramework>net6.0-windows</TargetFramework>

and I use this package:

<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.0" />

System.DirectoryServices.AccountManagement is supposed to work on Windows but I can not find what makes it think that it is on a different platform.

Any help will be much appreciated!

People have reported this error when using linux or docker deployments but I am using windows 10, and some people report that it is due to using

<TargetFramework>netstandard2.1</TargetFramework>

I have moved all my projects into

<TargetFramework>net6.0-windows</TargetFramework>

but it is still throwing this exception.

0

There are 0 answers