Blog Stats
  • Posts - 178
  • Articles - 0
  • Comments - 61
  • Trackbacks - 234

 

Sunday, July 03, 2005

System.configuration

This may be well known by now but not by myself. When you try to use ConfigurationSettings.AppSettings in the .NET Framework 2.0, you receive a message stating that AppSettings is obsolete, use ConfigurationManager.AppSettings instead. I did finally figure it out. ConfigurationManager does not exist in the default System.Configuration namespace. When you use System.Configuration, it loads the System.Configuration.dll assembly. If you manually set a reference to System.configuration.dll, you can easily find the needed ConfigurationManager.

I did a little searching after figuring this out and a few people are irritated that Microsoft chose this route. However, I think they would have been irate if backwards compatibility would have been broken. My hats off to the .NET Framework developers. There was obviously something lacking in System.Configuration and I think System.configuration is a great start.

As a side note, you can continue using ConfigurationSettings.AppSettings and your app will compile and all will be right with the world but resistance is futile. I strongly encourage using the ConfigurationManager. There are so many new features that will make your life easy, it is worth the effort to learn.

 

 

Copyright © Jason Bentley