This question describes my problem exactly, except I'm using a custom configuration section in app.config
with ConfigurationManager
, so the solution presented there doesn't apply...
Basically, my problem is that when ClickOnce updates the application, it installs into a different directory with the new app.config, thereby erasing any changes made. My application uses app.config to persist application settings, so this is very bad... a merged update would be excellent (similar to what is achieved in the other question), but just about anything automated would be good at this point.
Or should I just use a set location for my app.config file rather than try to use the default location?
ClickOnce should maintain user settings between updates but I have had this fail once or twice for unkown reasons (and with bad results). I haven't tried a custom configuration setting but I've lost confidence in ClickOnce's ability to not overwrite settings.
The approach I'm planning to use is to manually handle ClickOnce updates rather than allowing the app. to check for updates and prompt the user to install. I've also had a couple of users who didn't accept the update and that's a pain to recover from. By manually handling the update, I hope to be able to read user settings into memory before updating, then write them back out after the update is completed. There's an ApplicationUpdated event that should serve this purpose.
Perhaps this approach could work for you as well.
Edited to add references:
Googling for ApplicationDeployment should also help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With