I got the following warning
\'System.Configuration.ConfigurationSettings.AppSettings\' is obsolete: \'\"This method is obsolete, it has been replace
as its a warning i dont think it matters unless you have turned off a treat warnings as errors setting
add a reference to System.Configuration
all you have to do is to update to the latest code so where you used ConfigurationSettings.AppSettings[""] change to ConfigurationManager.AppSettings[""]
and this should work
I had the same problem in a C# project and I fixed it by writing appSettings instead of AppSettings in the XML file (camelCase expected) in the tag
<appSettings>
<add key="myKey" value="my Value"/>
<appSettings>
After all C# is case sensitive
Just replace
System.Configuration.ConfigurationSettings.AppSettings
with
System.Configuration!System.Configuration.ConfigurationManager.AppSettings
in your code.
I also face same issue, sometimes the assembly reference not loaded properly or if you are using multiple projects it give problems sometimes. You just add reference to assembly. Right Click>Add Reference>.Net>System.configuration> Click OK You can see now there are many configuration options available choose ConfigurationManager.AppSetting["Con"].ToString();
Build and Smile :)
Add a reference to the assembly System.Configuration
.
Then at the top (assuming C#) using System.Configuration (Imports System.Configuration in VB.NET).
Use ConfigurationManager.AppSettings["MySetting"]
to access the settings!
example:
replace
string smtpServer = System.Configuration.ConfigurationSettings.AppSettings["EmailServer"];
with
string smtpServer = ConfigurationManager.AppSettings["EmailServer"];
also make sure on the top of the case you add:
using System.Configuration;