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:
Right click the project and choose add reference, browse "Assemblies" and tick the System.Configuration assembly.
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With