Skip to main content

Posts

Showing posts from May, 2011

System.Configuration in .Net Framework 2 onwards - part 2

Some people asked why do you have to explicitly add  reference to System.Configuration.dll assembly? Why can't Visual Studio work out latest version based on the Target framework? Also why is this still the case in .Net Framwork 4.0? here is the secret..... In .Net 1.1, System.Configuration namespace was included in System.dll assembly. So they had to keep this namespace in all future release of .Net framework to make it backward compatible. From .Net 2.0 onwards, Microsoft created a new assembly System.Configuration.dll which includes the namespace System.Configuration. This namespace includes all new functionality. When you create a new project in Visual Studio (any version), by default it adds reference to System.dl. Hence when you just reference System.Configuration namespace using "Using or Imports", it references the namespace within System.dll. Hence you get old functionality. By adding a reference to System.Configuration.dll, now you have System.Config

System.Configuration in .Net Framework 2 onwards

Often application need custom configuration section. System.Configuration namespace includes classes for reading and writing configuration settings. There is a slight difference in how you use this namespace depending on the Framework version you are using Prior to .Net Framework 2.0, the .Net Framework included System.Configuration namespace, but that version of the namespace is now outdated. If you simply add the System.configuration namespace to your project (using in C#), your application references the outdated namespace. To refer to the updated namespace, follow these steps 1. In VS, open the project that requires System.Configuration namespace. 2. Click on the Project menu and then click Add Reference 3. On the .Net tab, Select System.Configuration as shown in following figure, and click OK 4. Now add the System.Configuration namespace to your project normally using Imports (in VB) or using (in C#) and your application will reference the correct version of the namespa