In this article I will explain how to use System.Configuration.ConfigurationManager in Windows Forms, Console, Class Library and Windows Service Applications in C# and VB.Net when the following error occurs.
The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
 
 
Cause
This issue generally happens in Windows Forms, Console, Class Library or Windows Service Applications as by default the System.Configuration Assembly is not referenced in these applications.
 
 
Solution
The solution is fairly simple i.e. to add reference of the System.Configuration Assembly to the project in the following way.
1. Right click on the project and click Add Reference option from the Context Menu.
The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
 
2. From the Add Reference dialog box, click on .Net Tab and look for System.Configuration assembly. Once you find it simply select and click OK.
The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
 
3. Once the reference is added, it will be shown in the References folder of the Solution Explorer.
The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)