System.DirectoryServices编译问题
我在这里使用代码: ASP. NET 如何获取 Active Directory 中的组列表
具体来说:
using System.DirectoryServices;
DirectoryEntry objADAM = default(DirectoryEntry); //compiler error!
问题:编译器说它不知道 DirectoryEntry 是什么。
我尝试将其添加到我的 web.config 中:
<assemblies>
<!-- ... -->
<add assembly="System.DirectoryServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
但是它似乎没有帮助所以我尝试添加参考:
有人建议设置Copy Local = True
但是也没有帮助。
我注意到我没有看到 System.DirectoryServices
的引用 - 只有 System.DirectoryServices.Accountmanagement
谁能帮我编译此代码?我不知道接下来要尝试什么。
I'm using the code here : ASP.NET How to get List of Groups in Active Directory
Specifically :
using System.DirectoryServices;
DirectoryEntry objADAM = default(DirectoryEntry); //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:
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
Can anyone help me get this code to compile? I'm not sure what to try next.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在“添加引用”对话框中取消 .net 3.5 过滤器,然后在项目中添加一个引用:
System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
您可以采用通过更改项目设置来关闭过滤器:http://msdn.microsoft.com/en-us/library/bb398202.aspx
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
如果要使用
System.DirectoryServices
命名空间中的DirectoryEntry
- 您需要添加对System.DirectoryServices
程序集的引用 - 不是System.DirectoryServices.AccountManagement
程序集!If you want to use the
DirectoryEntry
from theSystem.DirectoryServices
namespace - you need to add a reference to theSystem.DirectoryServices
assembly - NOT theSystem.DirectoryServices.AccountManagement
assembly!