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


Question

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?

2
29
8/18/2011 12:04:12 PM

Accepted Answer

Is the web-server (IIS or whatever) configured to run the folder as an application (i.e. shows as a cog), and is it using the correct version of ASP.NET? If it is running as 1.1, bits of it might work - but it would fail to find that 2.0 assembly in the 1.1 GAC.

6
11/5/2008 1:46:14 PM

Exper Answer

Is this a web site project, or a web application project. With the latter, references are handled via the .csproj - i.e. via the "References" node in Solution Explorer.

1
11/5/2008 1:19:11 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon