自动[升级"从app.config文件的previous版本的用户设置? [英] Automatically "upgrade" user settings from previous version of app.config file?
问题描述
我每次编译我的应用程序和版本号的变化(我有一个自动递增的版本号),我失去了用户配置的app.config设置,因为它们存储在应用程序数据文件夹中的一个特定版本。从本质上讲,我的应用程序的每个版本从头开始,只要用户设置去了。
Every time I compile my app and the version number changes (I have an auto-incrementing build number), I lose the user-configured app.config settings, since they're stored in the AppData folder for a specific version. Essentially, every release of my application starts from scratch as far as user settings go.
虽然这是发展一个温和的烦恼,它提出了一个问题,因为我接近部署/释放一个补丁改变我的应用程序?如果是这样,有一个简单的方法来提升,从previous发布的设置的版本号?我知道,在注册表中使用HKCU是另一种选择,但我喜欢轻松的My.Settings命名空间,我想留在app.config中。
While this is a mild annoyance in development, it raises the question as I approach deployment/release - if I use the app.config to store my user settings, will the user's personalized settings be hosed every time they install a patch that changes the version number of my app? If so, is there an easy way to "upgrade" the settings from the previous release? I know that using HKCU in the registry is another option, but I like the ease of the My.Settings namespace, and I'd like to stay with app.config.
<一个href="http://stackoverflow.com/questions/621265/net-2-0-application-settings-user-config-file-location">Another SO质疑问类似的事情,但答案似乎并不清晰。将设置我的MSI,因此要求升级足以preserve这些用户级别设置的用户?
Another SO question asks something similar, though the answer doesn't seem that clear. Will setting my MSI so it asks the user to upgrade be enough to preserve these user-level settings?
推荐答案
你看<一href="http://msdn.microsoft.com/en-us/library/system.configuration.applicationsettingsbase.upgrade.aspx">ApplicationSettingsBase.Upgrade()?它允许设置可使用以下调用一个previous版本升级:
Have you looked at ApplicationSettingsBase.Upgrade()? It allows the settings to be upgraded from a previous version using the following call:
My.Settings.Upgrade()
这篇关于自动[升级&QUOT;从app.config文件的previous版本的用户设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!