SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Visual Studio 2010. When I want to use PrincipalContext Class, the Visual Studio couldn't find the Reference:

enter image description here

I have opened the project with .NET Framework 4 selected and my project was targeting .NET Framework 3.5 in Project Properties.

.NET Framework 3.5+ should have System.DirectoryServices but why this happens?

PS: I am using Application page.

share|improve this question
Have you added a reference to System.DirectoryServies.AccountManagement in your project? Are you using that namespace in your code file? – TZHX Dec 23 '12 at 7:45
There is no "System.DirectoryServies" in Reference List to Add! I have no idea what's happening... – Natasha Dec 23 '12 at 7:48
up vote 4 down vote accepted

I think System.DirectoryServices requires an manual reference to System.DirectoryServices.dll which can be done just by right clicking your project in solution explorer -> Add Reference -> in .NET Tab,

select "System.DirectoryServies.AccountManagement".

Now, you should be able to import System.DirectoryServies.AccountManagement namespace.

Adding Reference to System.DirectoryServies.AccountManagement

If you still can't see it like its shown in above picture then you should try adding reference like this,

<add assembly="System.DirectoryServices.AccountManagement, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

It doesn't matter if you are using application page or not, I would recommend you to go through this article for a better understanding of this new class for Directory services.

Hope it helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.