My ClickOnce app includes an app.config
file, which the app does modify according to the user's preferences. I开发者_StackOverflow社区t appears, though, that every time my clients get a new version of the app, the app.config
file gets reset to its original state.
Is there any way to preserve the app.config
file between ClickOnce updates?
The app.config is used to store application configurations. For user custom configurations you should be using a .settings file.
The only way I know to keep the user app config is to save a copy of the file before publishing and, post publishing, replace the
publish_dir/version_dir/app.config.deploy
with the copy.
I would separate the configuration settings from the application cache. We rolled our own class for storing and updating config values rather than use the built-in ones.
http://robindotnet.wordpress.com/2009/08/19/where-do-i-put-my-data-to-keep-it-safe-from-clickonce-updates/
精彩评论