Sachu Sachu - 1 month ago 8
C# Question

Settings value saved during run time is not changing from design in visual studio

At my settings file i have a parameter "Is_Running" and it value is set as 0

at run time i will check the value like below

if(Settings.Default.Is_Running == 0)
{
Settings.Default.Is_Running = 1;
Settings.Default.Save();
upload_file();
Settings.Default.Is_Running = 0;
Settings.Default.Save();
}


Due to some reason i stopped the program in the middle of execution. Now the condition is always failing. So i checked value of
Is_Running
using a message box and it shows "1". I checked the app config file and it shows below

<setting name="Is_Running" serializeAs="String">
<value>0</value>
</setting>


Any idea why it still use "1"?

Answer

In VS you change the default values of settings. Real settings are stored in the path C:\Users\<UserName>\AppData\Local\<CompanyName>\<AppName>\<v‌​ersion>\user.config (for apllications).

Thanks for the answer..Since my application is windows service installe in server level the path is little different. What i done is searched for user.config then got the file and path. Changed the value to 0 and it worked fine.

Path in my case the path is

C:\Windows\SysWOW64\config\systemprofile\AppData\Local\<application_folder_name>
\<application_name>.exe_Url_i2ihim0th2qofysr3qhd52qhamfkxsy5\1.0.0.0\user.config