NullSoft Installer - Upgrade app.config when upgrading application
I am using NSIS to install my application and I am trying to prepare ahead of time for future updates. Normally with ClickOnce, I'd be able to call the Upgrade() method to update the user's settings by accessing their settings from the previous installation. Unfortunately, when using the NullSoft Installer the new config file is packaged along with everything else and overwrite开发者_运维知识库s the existing one upon installation. What would be the most effective way to maintain a user's settings when upgrading the application and merging them with a new config file?
My idea so far is to store a copy of the user's config file in a separate location and then on startup, check to see if the application has been upgraded by comparing the assembly version with a setting in the config file that contains the previous assembly version. If it appears the application has been upgraded, it would then proceed to somehow merge the old config with the new one, but I am not sure what would be the safest/most effective way to do this.
My strategy for a safe upgrade would be to only add new elements and attributes from the new xml file to the original one. However, rather than copy the new xml file, I would have a list of xpaths and values in a CSV that the program would check for on startup and execute against its config file.
精彩评论