Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.PlatformNotSupportedException: System.DirectoryServices.AccountManagement is not supported on this platform Windows 10 #84831

Open
voh83 opened this issue Sep 27, 2020 · 8 comments

Comments

@voh83
Copy link

voh83 commented Sep 27, 2020

Hi All.

I'm trying to connect to Active Directory within my company scope, and i setted up a simple test

with dotnet CLI i run:
dotnet add package System.DirectoryServices.AccountManagement --version 4.7.0

with dotnet fsi i run:

#r "C:\\Users\\ABSD\\.nuget\\packages\\system.directoryservices.accountmanagement\\4.7.0\\lib\\netstandard2.0\\System.DirectoryServices.AccountManagement.dll"
open System.DirectoryServices.AccountManagement
let dEntry = new PrincipalContext(ContextType.Domain,"LDAP://server-path:389")

But i receive this error:

System.PlatformNotSupportedException: System.DirectoryServices.AccountManagement is not supported on this platform.
   at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name)
   at <StartupCode$FSI_0012>.$FSI_0012.main@()
Detenido debido a un error.

dotnet --info

SDK de .NET Core (reflejando cualquier global.json):
 Version:   3.1.402
 Commit:    9b5de826fd

Entorno de tiempo de ejecución:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.402\

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

.NET Core SDKs installed:
  3.1.402 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

I searched over internet but all the same problem was by using Linux/MAC no information with Windows.

@voh83 voh83 changed the title System.PlatformNotSupportedException: System.DirectoryServices.AccountManagement is not supported on this platform. at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name) at <StartupCode$FSI_0012>.$FSI_0012.main@() Detenido debido a un error. System.PlatformNotSupportedException: System.DirectoryServices.AccountManagement is not supported on this platform Windows 10 Sep 27, 2020
@marcpopMSFT marcpopMSFT added the untriaged New issue has not been triaged by the area owner label Oct 8, 2020
@AMoghrabi
Copy link

Hey @dnomar , were you able to get passed this problem by any chance? I'm running into it as well. Works fine when running on Windows outside of docker. When containerized, I receive the same error as you.

Thanks.

@voh83
Copy link
Author

voh83 commented Nov 7, 2020

No, i use an alternative server with iis/.net framework instead and it works. This library does no work if your docker runs over linux or mac is only for windows.

@joeloff
Copy link
Member

joeloff commented Nov 11, 2020

@terrajobst is this related to #14734?

@iinuwa
Copy link
Contributor

iinuwa commented Jun 25, 2021

System.DirectoryServices.AccountManagement is only supported on Windows. As you noticed, you will get this error when trying to run on Linux, which includes running Linux containers using Docker for Windows.

To track S.DS.AM support for Linux, see #37100.

@joeloff, this can probably be closed as a duplicate of that issue.

@Turhan8
Copy link

Turhan8 commented Apr 14, 2023

I am getting same error while debugging:
"System.DirectoryServices.AccountManagement is not supported on this platform."
I am running on Windows. I am targetting
<TargetFramework>net6.0-windows</TargetFramework>
and I use
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.0" />
package.
I could not find anything that has S.DS.AM in my bin folder.
Can you please advice how to fix this error?

@danmoseley danmoseley transferred this issue from dotnet/sdk Apr 14, 2023
@ghost
Copy link

ghost commented Apr 14, 2023

Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014
See info in area-owners.md if you want to be subscribed.

Issue Details

Hi All.

I'm trying to connect to Active Directory within my company scope, and i setted up a simple test

with dotnet CLI i run:
dotnet add package System.DirectoryServices.AccountManagement --version 4.7.0

with dotnet fsi i run:

#r "C:\\Users\\ABSD\\.nuget\\packages\\system.directoryservices.accountmanagement\\4.7.0\\lib\\netstandard2.0\\System.DirectoryServices.AccountManagement.dll"
open System.DirectoryServices.AccountManagement
let dEntry = new PrincipalContext(ContextType.Domain,"LDAP://server-path:389")

But i receive this error:

System.PlatformNotSupportedException: System.DirectoryServices.AccountManagement is not supported on this platform.
   at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name)
   at <StartupCode$FSI_0012>.$FSI_0012.main@()
Detenido debido a un error.

dotnet --info

SDK de .NET Core (reflejando cualquier global.json):
 Version:   3.1.402
 Commit:    9b5de826fd

Entorno de tiempo de ejecución:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.402\

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

.NET Core SDKs installed:
  3.1.402 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

I searched over internet but all the same problem was by using Linux/MAC no information with Windows.

Author: voh83
Assignees: joeloff
Labels:

area-System.DirectoryServices, untriaged

Milestone: -

@buyaa-n
Copy link
Member

buyaa-n commented Apr 20, 2023

I am getting same error while debugging:
"System.DirectoryServices.AccountManagement is not supported on this platform."
I am running on Windows. I am targetting
net6.0-windows

@Turhan8 I don't think your TFM targeting windows matters, the message suggests somehow your app running on non-windows. Anyway tagging @joperezr @BRDPM @grubioe @jay98014 if they have any suggestion for you.

I could not find anything that has S.DS.AM in my bin folder.

What happens when you run: dotnet add package System.DirectoryServices.AccountManagement --version 7.0.0

@buyaa-n buyaa-n added this to the Future milestone Apr 20, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Apr 20, 2023
@chrpai
Copy link

chrpai commented Feb 22, 2024

Does anyone know of any libraries that do support LDAP queries from mac? I had the impression s.ds.protocols did but that gives me a non supported exception also when I try to do a LdapConnection.Bind()

Clarification. I can bind using a NetworkCredential and AuthType.Basic. I'm new to Mac so I don't know the limitations. I know we have some kind of corporate binding on our Mac devices and I can connet to AD SMB shares and visit IIS websites that are using Windows Auth. without being prompted for creds so I'm trying to do similiar. I don't want to have to ask my users to enter their creds unless absolutely needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants