In .net frameworks 1.1, I use
System.Configuration.ConfigurationSettings.AppSettings["name"];
for application settings. But in .Net 2.0, it says ConfigurationSettings is obsolete and to use ConfigurationManager instead. So I swapped it out with this:
System.Configuration.ConfigurationManager.AppSettings["name"];
The problem is, ConfigurationManager was not found in the System.Configuration namespace. I've been banging my head against the wall trying to figure out what I'm doing wrong. Anybody got any ideas?
You have to reference the System.configuration assembly (note the lowercase)
I don't know why this assembly is not added by default to new projects on Visual Studio, but I find myself having the same problem every time I start a new project. I always forget to add the reference.
If you're just trying to get a value from the app.config file, you might want to use:
ConfigurationSettings.AppSettings["name"];
That works for me, anyways.
/Jonas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With