开发者

Refresh/clear cache of app.config

开发者 https://www.devze.com 2023-01-07 07:23 出处:网络
I\'m trying to get update values from app.config while it\'s running. I tried several methods but it still uses old values. How can I get correctly refresh it? I tried these but it didn\'t work:

I'm trying to get update values from app.config while it's running. I tried several methods but it still uses old values. How can I get correctly refresh it? I tried these but it didn't work:

MessageBox.Show(Properties.Settings.Default.MyValue);
Properties.Settings.Default.Reload();
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.Reset();
ConfigurationManager.RefreshSection("applicationSettings");
ConfigurationManager.RefreshSection("/applicationSettings/");
ConfigurationManager.RefreshSection("/configuration/applicationSettings");
MessageBox.Show(Properties.Settings.Default.MyValue);

The value of MyValue is "first value".

This first displays "first value". While the message box is still open I manually change it from my.exe.config to "second value" and the second message box still displays "first value". I'm not running the solution, I'm directly running the exe from bin folder so it's not vsho开发者_如何学Pythonst problem.

What should I do?


Did you check config in Documents and Settings/youruser (Users for Windows7)?

0

精彩评论

暂无评论...
验证码 换一张
取 消