When you’re upgrading code from .NET Framework 1.1 to 2.0, you will get a few warnings if you use an obsolete API such as ConfigurationSettings.GetConfig, you may see something similar to this:
This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.GetSection
To which you have to replace it with ConfigurationManager.GetSection(). Or the same way with ConfigurationSettings.AppSettings.Get() to ConfigurationManager.AppSettings.Get(). The problem is after you made the change, you will encounter another error during compilation such as this:
'ConfigurationManager' is not a member of 'Configuration'.
The solution, while it’s not intuitive is actually very simple. You need to add a reference to System.Configuration.dll to the assembly.
-
If you’re using a default view, on the right pane of your Visual Studio under your project you can right click on the References and select Add Reference….
-
Under Assemblies, look for System.Configuration and make sure it’s checked, then click OK.
That’s all there is to it.
Leave a Reply