views:

69

answers:

2

Hi All,

I see a very good post here about what I am wanting to do,

http://stackoverflow.com/questions/1831291/net-3-5-to-read-connectionstring-from-app-config

It says to use the ConfigurationManager class. I cannot reference the ConfigurationManager class.

If I look at the system.dll that I am using (which is v2.0.50727) there is no ConfigurationManager class.

I am using VS 2008, and my project is set to compile as .NET 3.5.

If I do this,

string test = System.Configuration.ConfigurationManager.AppSettings["test"];

I get the message 'Error 182 The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)'

Any ideas?

+2  A: 

The ConfigurationManager is part of the System.Configuration namespace. By default it is not referenced in the projects, so add a reference to if from the GAC.

Dustin Laine
Yep, as mentioned above I was referencing the namespace 'System.Configuration' in the 'System' dll
peter
+1  A: 

You have reference the 'system.configuration.dll'

just right click in VS on the reference folder, and search this dll

Nealv