System.DirectoryServices is not recognised in the namespace 'System'

jansokoly picture jansokoly · Nov 5, 2008 · Viewed 78.7k times · Source

I'm trying to use System.DirectoryServices in a web site project and I'm getting this error:

The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)

My project has a reference to System.DirectoryServices in web.config:

<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>  

And I do have using System.DirectoryServices in the files where I want to use it.

Does anybody have a clue where to look for the problem?

Answer

user1947015 picture user1947015 · Jan 3, 2013
  1. Right click on References under your solution.
  2. Select Add Reference. The reference can be found under the Framework Assemblies list. Select System.DirectoryServices and click Add.