Изменения в App.config возвращаются после выхода - PullRequest
0 голосов
/ 14 ноября 2018

Я изменяю свой MyApp.vhost.exe, и App.vhost.exe изменяется, как я вижу в текстовом редакторе, но когда я останавливаю приложение отладки, значения App.config возвращаются к тому, что они были до изменения. Что я делаю не так или чего мне не хватает?

Configuration exeConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var section = exeConfiguration.GetSection(monitorSectionElementName);

if (section != null)
{
    var monitorPathElements = (section as MonitorSection).MonitorPaths;
    monitorPathElements[monitorPath].CheckSum = checkSum;
}

exeConfiguration.Save(ConfigurationSaveMode.Full, true);
ConfigurationManager.RefreshSection(monitorSectionElementName);
...