Gibe Talkin'

Blog

ConfigurationSettings.AppSettings is obsolete

Posted by Steve Temple

I've been porting some code from .NET 1.1 to .NET 2. The compiler gives me a few of the following error:

'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 
'This method is obsolete, it has been replaced by ConfigurationManager.AppSettings'

It seems you can no longer do this:

System.Configuration.ConfigurationSettings.AppSettings[connstr].ToString();

You should do this instead:

System.Configuration.ConfigurationManager.AppSettings[connstr].ToString();

you then get an error where ConfigurationManager can't be found, apparently the System.Configuration.ConfigurationSettings class is found in the System.dll assembly. The ConfigurationManager class is found in the system System.Configuration.dll which must be referenced first.

Read blog post »