CSharp/C# >> System.Configuration ConfigurationManager

by Stefan Hoffmann » Tue, 09 Sep 2008 19:04:53 GMT

hi @all,

I have a project without a reference to System.Configuration.

Why can I use the static class ConfigurationSettings, but not the static
class ConfigurationManager?

I can use ConfigurationManager when adding the reference explicitly to
my project.

btw, after adding this reference, it is displayed as
"System.configuration" with a lower-case c.


mfG
--> stefan <--


CSharp/C# >> System.Configuration ConfigurationManager

by Marc Gravell » Tue, 09 Sep 2008 20:10:04 GMT


> Why can I use the static class ConfigurationSettings, but not the static

Because ConfigurationSettings is in System.dll; ConfigurationManager
is in System.Configuration.dll

Marc

CSharp/C# >> System.Configuration ConfigurationManager

by Duggi » Tue, 09 Sep 2008 21:00:04 GMT


by default VS adds using system; system.dll reference is already
added.

However ConfigurationManager belongs to System.Configuration.dll which
you added manually.

-Cnu

CSharp/C# >> System.Configuration ConfigurationManager

by Stefan Hoffmann » Tue, 09 Sep 2008 22:04:09 GMT

Thanks to both of you.

I'm still getting confused sometimes by the differences between files
and namespaces.


mfG
--> stefan <--

Similar Threads

1. System.Configuration.ConfigurationManager.AppSettings - question - CSharp/C#

2. System.Configuration.ConfigurationManager.AppSettings

Hi there

is there any way to tell what .config file the property 
System.Configuration.ConfigurationManager.AppSettings is trying to access?

I have a class which uses this property but no appSettings are being loaded, 
so I am guessing it is trying to access a different config file than I think 
it is.

Thanks,
Peter 


3. question about WinForm projects, System.Configuration.ConfigurationManager, and Connection Strings - ADO.Net

4. Accessing System.Configuration.ConfigurationManager

Hi,
Im still very new in the land of .NET and having problems trying to
access the System.Configuration.ConfigurationManager to read&write
application settings.

I downloaded a sample project with the following code
using System.Configuration
SqlConnection cn = new
SqlConnection(ConfigurationManager.ConnectionStrings["AW"].ConnectionString)

and this works fine.

I created a c# windows application, added the using clause to the
Program.cs file, but when I type, Intellisense does not recognise the
ConfigurationManager, and this produces an error during build phase.
I checked the .net project references for both projects and they both
use
System.Configuration version 2.0.0.0 runtime v2.0.50727 C:\Windows
\Microsoft.net\framework\v2.0.50727\system.configuration.dll

Intellisense on the project that works includes many items under
System.Configuration, but Intellisense on my project only includes
ConfigurationException and ConfigurationSettings.

Can anyone tell me why my project doesnt recognise
System.Configuration.ConfigurationManager?

thanks,
Mark.

5. problem System.Configuration.ConfigurationManager.ConnectionStrings - .Net Framework

6. System.Configuration.ConfigurationManager problems, like it doesn't exist.

Hi,

I have a Visual studio 2005 project that runs as a Windows Service. In
it I have declared that I am using System.Configuration.

I have set one application setting for the service using the settings
panel.

When I try to do the following;

ConfigurationManager.AppSettings[name of the setting being used];

I get the error warning that Error	2	The name 'ConfigurationManager'
does not exist in the current context

If I try the
System.Configuration.ConfigurationManager.AppSettings it tells me that
ConfigurationManager is not part of System.Configuration.

If I try to use ConfigurationSettings of course it tells me that it is
obsolete, which is undoubtedly a bad thing but I really like the thing
that it works as opposed to the correct ConfigurationManager which
doesn't.

7. System.Configuration.ConfigurationManager - Microsoft .NET Framework

8. System.Configuration.Configuration

Can you tell me how to read and modify a value in the app.config file using 
this class?
Thank you very much