New in .NET 2.0: ConfigurationManager.AppSettings Property
Microsoft now disapproves of the use of ConfigurationSettings (in the System.Configuration namespace) for the retrieval of application and machine configuration settings. The .Net 2.0 now exposes a ConfigurationManager class that "replaces" ConfigurationSettings.
I guess this one should soon be a FAQ (or already is) but I just wanted to write it down. Suppose, you convert a simple 2003 web project to 2005. You compile it. Now you get a warning on ConfigurationSettings.AppSettings Property:
"This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings"
I want to describe what happens since the warning message is not descriptive enough, imho, especially for people who are not familiar with .NET 2.0 yet.
What to do in order to use ConfigurationManager class ? System.Configuration.dll - ensure you add a reference to this assembly. In .NET 2.0 all configuration functionality is in this separate assembly now. Please note: you can find System.Configuration namespace also in System.dll assembly, for example ConfigurationSettings is still there, so it can cause some confusion.
Unrelated: strange that in VS 2005 solution tree - System.configuration reference visually has "c" in lower case. Why ?
Sunday, November 6, 2005 2:24 AM