开发者

System.DirectoryServices compilation problems

开发者 https://www.devze.com 2023-04-02 18:28 出处:网络
I\'m using the code here : ASP.NET How to get List of Groups in Active Directory Specifically : using System.DirectoryServices;

I'm using the code here : ASP.NET How to get List of Groups in Active Directory

Specifically :

using System.DirectoryServices;

DirectoryEntry objADAM = default(Directory开发者_运维知识库Entry); //compiler error!

Problem: compiler says that it doesn't know what DirectoryEntry is.

I tried to add it to my web.config:

      <assemblies>
          <!-- ... -->
          <add assembly="System.DirectoryServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>

But it didn't seem to help so I tried to add a reference:

System.DirectoryServices compilation problems

Someone suggested setting Copy Local = True but that didn't help either.

I noticed that I don't see a reference for System.DirectoryServices - only System.DirectoryServices.Accountmanagement

System.DirectoryServices compilation problems

Can anyone help me get this code to compile? I'm not sure what to try next.


Take the .net 3.5 filter off in the Add Reference dialog, and then put a reference in your project to:

System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

You can take the filter off by changing you project setting : http://msdn.microsoft.com/en-us/library/bb398202.aspx


If you want to use the DirectoryEntry from the System.DirectoryServices namespace - you need to add a reference to the System.DirectoryServices assembly - NOT the System.DirectoryServices.AccountManagement assembly!

System.DirectoryServices compilation problems

0

精彩评论

暂无评论...
验证码 换一张
取 消