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.Configuration namespace available from two assemblies: System.dll and System.Configuration.dll. The compiler resolves the reference to the classes to either assembly depending on which class/method you are using. However as System.Configuration namespace from System.dll is marked as Obsolete (I guess using attributes), you get a compiler warning if you use old functionality. This could one of the reason they have changed ConfigurationSettings to ConfigurationManager so that it resolves to correct namespace. Now you know why!
Mystery solved!
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.Configuration namespace available from two assemblies: System.dll and System.Configuration.dll. The compiler resolves the reference to the classes to either assembly depending on which class/method you are using. However as System.Configuration namespace from System.dll is marked as Obsolete (I guess using attributes), you get a compiler warning if you use old functionality. This could one of the reason they have changed ConfigurationSettings to ConfigurationManager so that it resolves to correct namespace. Now you know why!
Mystery solved!
Comments