Difference between ConfigurationSettings and ConfigurationManager

If you upgraded a project from .Net 1.0/1.1 to .Net 2.0, and it used application configuration files, you will soon come across the compiler warning message

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

You have to add a reference to the System.Configuration assembly, but once you do, you can just do a search and replace on ConfigurationSettings.AppSettings and replace it with ConfigurationManager.AppSettings and the functionality will remain the same.

The advantage of using ConfigurationManager is laid out in the MSDN docs, but briefly:

  1. Access sections other than appConfig, including connectionStrings, and your own custom sections
  2. Can read and write the configuration.
  3. It can have separate settings for the application and the users
  4. It’s extensible

Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code by Ben Watson. Available now as an eBook at:

9 thoughts on “Difference between ConfigurationSettings and ConfigurationManager

  1. Ben Post author

    king, in Visual Studio, right-click on the project in Solution Explorer, from the .Net tab, scroll to choose System.Configuration, click Ok.

  2. Pingback: ConfigurationSettings Vs ConfigurationManager « Evolving Techie's Blog

  3. Sonny

    You ROCK Ben!!!!! Even after 4 years, your post was able to help me understand and resolve my issue.

  4. ajay Babu Devalla

    Inorder to add reference to System.Configuration we have to right click on the Project and click on ‘Add Reference’.
    Now a new window opens.Here click on .net Tab,Now Scroll down inorder to select the System.Configuration.Install.dll and click on the ‘select’ button.

    Now finally click ‘ok’ button to add reference

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>