简体   繁体   English

如何在ClickOnce应用更新之间保留app.config?

[英]How to preserve app.config between ClickOnce app updates?

My ClickOnce app includes an app.config file, which the app does modify according to the user's preferences. 我的ClickOnce应用程序包含一个app.config文件,应用程序根据用户的首选项进行修改。 It appears, though, that every time my clients get a new version of the app, the app.config file gets reset to its original state. 但是,似乎每次我的客户端获得应用程序的新版本时, app.config文件都会重置为其原始状态。

Is there any way to preserve the app.config file between ClickOnce updates? 有没有办法在ClickOnce更新之间保留app.config文件?

The app.config is used to store application configurations. app.config用于存储应用程序配置。 For user custom configurations you should be using a .settings file. 对于用户自定义配置,您应该使用.settings文件。

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 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/ http://robindotnet.wordpress.com/2009/08/19/where-do-i-put-my-data-to-keep-it-safe-from-clickonce-updates/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM