How To: Set Up Your Development Environment to Use System.DirectoryServices.ActiveDirectory
This topic describes how to set up a Visual Studio .NET project that uses members of the System.DirectoryServices.ActiveDirectory namespace.
To use System.DirectoryServices.ActiveDirectory
Start Visual Studio .NET.
Click File>New>Project.
In the Project Type column, choose the project type to create (C# or Visual Basic .NET).
In the Template column, choose a project template (for example, Console Application or Windows Application).
Name your project.
Click OK to create your new project.
Click Project>Add Reference.
Choose System.DirectoryServices.dll from the list.
Click OK to add the reference.
Add the following line to your code:
For C#:
Using System.DirectoryServices.ActiveDirectory;
For VB.NET:
Imports System.DirectoryServices.ActiveDirectory
Compiling the Code
Tip It is unnecessary to add the namespace using statement (Imports statement in VB .NET) to your code, but it can simplify object names. If you do not add this statement, then you must declare and reference each System.DirectoryServices.ActiveDirectory object with its fully-qualified name, such as System.DirectoryServices.ActiveDirectory.DirectoryContext instead of DirectoryContext.
See Also
Reference
System.DirectoryServices.ActiveDirectory
Concepts
System.DirectoryServices.ActiveDirectory Namespace Overview
System.DirectoryServices.ActiveDirectory Scenarios
Send comments about this topic to Microsoft.
Copyright © 2008 by Microsoft Corporation. All rights reserved.