Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is ConfigurationManager's namespace?

ConfigurationManager is a part of the System.Configuration after .Net 2.0. Add a reference to the System.Configuration dll. Try using System.Configuration.ConfigurationManager.


You need to use the System Configuration namespace, this must be included in two ways:

  1. Right click the project and choose add reference, browse "Assemblies" and tick the System.Configuration assembly.

  2. Include the namespace in code:

    using System.Configuration;


You need to add a reference the System.Configuration assembly. This namespace was split across a few assemblies.


You will need to add the System.Configuration reference under the Reference folder in your project. Only adding the system.configuration with the using statement in your class is not enough.


I'm working in VisualStudio 2015, and ConfigurationManager is not present at System.Configuration namespace anymore.

I was just trying to read the App.config file...

Then I found a solution:

Get:

string str = MyProjectNamespace.Properties.Settings.Default["MySettingName"].ToString();

Set:

MyProjectNamespace.Properties.Settings.Default["MySettingName"]="myString";
MyProjectNamespace.Properties.Settings.Default.Save();