错误 1 命名空间“System”中不存在类型或命名空间名称“DirectoryServices”。是否缺少程序集引用?

[复制链接]
查看11 | 回复2 | 2011-6-13 04:17:43 | 显示全部楼层 |阅读模式
代码如下:
usingSystem;
usingSystem.DirectoryServices;
classTempClass
{
staticvoidMain()
{
EnumComputers();
}
staticvoidEnumComputers()
{
using(DirectoryEntryroot=newDirectoryEntry(\"WinNT:\"))
{
foreach(DirectoryEntrydomaininroot.Children)
{
Console.WriteLine(\"Domain|WorkGroup:\\t\"domain.Name);
foreach(DirectoryEntrycomputerindomain.Children)
{
Console.WriteLine(\"Computer:\\t\"computer.Name);
}
}
}
}
}
回复

使用道具 举报

千问 | 2011-6-13 04:17:43 | 显示全部楼层
右键在引用文件夹点击,添加-项目-浏览-DirectoryServices.dll就可以了
回复

使用道具 举报

千问 | 2011-6-13 04:17:43 | 显示全部楼层
怎么添加
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行