Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'DirectoryServices' does not exist in the namespace 'System'

Status
Not open for further replies.

mrgulic

Technical User
Sep 18, 2001
248
US
I am new to .NET, C# and programming in general.

Anyway, I am trying work with the System.DirectoryServices namespace. The build completes sucessfully but I keep getting an error in the browser. (see below).

I have added the System.DirectoryServices reference, pointing to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.DirectoryServices.dll

I read on one forum that said in the properties of the reference change 'Copy Local' from 'false' to 'true'.

I dont get the error anymore but I want to understand what the impact in doing this is. Mainly I don't understand why the error happened in the first place as another c# project had the same reference but i did not get the error.

Thanks for your time and information.

Code:
Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

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

Source Error:

 

Line 3:  using System.Configuration;
Line 4:  using System.Data;
Line 5:  using System.DirectoryServices;
Line 6:  using System.Linq;
Line 7:  using System.Web;
 

Source File: c:\Visual Studio 2008\Projects\intranet\pages\ads_tools.aspx.cs    Line: 5
 
You need to right click References > Add Reference then search for System.DirectoryServices that way before you can use it.

Regards,

Martin

Computing Design And Services:
 
I added the refrence that way, from the .NET tab. The UNC path is just to illistrate where the dll is located. I am using VS2008 with .Net 3.5 by the way.
 
You should not need to copy local for System.DirectoryServices.dll.

I follow the practice that if it's in the GAC I do not copy local. The only assemblies registered with the GAC are the .net framework assemblies themselves. Any other 3rd party assemblies are reference locally and copy local. I find this help manage versioning differences of 3rd party frameworks between applications.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
I wouldn't think you would have to but unless i do the "copy local" i get the error as described above. It has to be my enviorment because I referenced the same namspace on my work server and i didnt need the "copy local".

I would just like to know why my installation at home is all of a sudden doing this. Last week I didnt have to "copy local". There has been no updates, or other changes made. The only difference is this is a new solution, created just like the previous one.

Thanks again for your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top