The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' - C#
Формулировка задачи:
Подскажите, пожалуйста! Только начинаю на C# писать! Вот такой вроде небольшой кодик:
Ошибка выпадает сразу:
The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?) C:\Documents and Settings\user\Мои документы\Visual Studio 2005\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs
Пишу в MS Visual C# 2005 Express
Хотел добавить System.DirectoryServices.ActiveDirectory в reference в solution? но так и не получилось: нажимаю add reference - атам пустое окно вываливается с ok и cancel
Помогите
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.DirectoryServices.ActiveDirectory;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- ShowMyDomains();
- }
- public static void ShowMyDomains()
- {
- DomainCollection domains = Forest.GetCurrentForest().Domains;
- foreach (Domain domain in domains)
- {
- Console.WriteLine(domain.Name);
- }
- }
- }
- }
Решение задачи: «The type or namespace name 'DirectoryServices' does not exist in the namespace 'System'»
textual
Листинг программы
- Хотел добавить System.DirectoryServices.ActiveDirectory в reference в solution? но так и не получилось: нажимаю add reference - атам пустое окно вываливается с ok и cancel
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д