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

  1. Start Visual Studio .NET.

  2. Click File>New>Project.

  3. In the Project Type column, choose the project type to create (C# or Visual Basic .NET).

  4. In the Template column, choose a project template (for example, Console Application or Windows Application).

  5. Name your project.

  6. Click OK to create your new project.

  7. Click Project>Add Reference.

  8. Choose System.DirectoryServices.dll from the list.

  9. Click OK to add the reference.

  10. 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.