【发布时间】:2012-01-21 02:08:46
【问题描述】:
(我的问题与this one类似,但代码略有不同,解决方案对我不起作用)
我正在尝试将设置更改保存到app.config:
Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
config.AppSettings.Settings("HistoryRootDirectoryPath").Value = p_historySavingPath
config.Save(ConfigurationSaveMode.Modified)
ConfigurationManager.RefreshSection("appSettings")
任何内容都不会保存到 bin 文件夹中的 exe.config 文件中,也不会保存到实际的 app.config 文件中。我做错了什么?
【问题讨论】:
-
您是否遇到任何错误?例外?您是否同时查看了
Debug和Release文件夹? -
@Oded:检查了调试和发布,没有抛出异常。
-
我发现它保存在“**.vshost.exe.config”中
-
啊。因为代码是在 Visual Studio 进程宿主下运行的。
标签: .net vb.net .net-4.0 configuration app-config