I always tell developers to create 2 (or possibly more) XML files. One that is owned by the installer and one that is owned by the application / user. The installer will 100% own the file that it installs and there is no expectation that the installer won't overwrite when it needs to.
The second file will get created by the application and the installer won't even know anything about it unless specifically asked to remove it during uninstalls. It is then the job of the application code to load those two sets of information and merge them. (Typically base and override settings.) We had a shared "product line" at my last job where an asset might be reused by multiple products (think Visual Studio components and all the SKUs that use them ). It was all dependency injection driven typically via XML files. The asset might have a base default config file, the domain (business area) might have an extension/override config file, a product might have an extension/override config file and finally at runtime another config file might get generated to store user and / or machine settings. All of these config files taken together would create a blueprint for how that asset should function in that environment. As far as the installer was concerned it was just a bunch of file copies. It was more work for the developers but once they created the shared libraries to handle it and got into the practice of thinking this way things ended much better. ---------------------------------------- From: "John Cooper" <jocoo...@jackhenry.com> Sent: Friday, November 01, 2013 8:25 AM To: "General discussion about the WiX toolset." <wix-users@lists.sourceforge.net> Subject: Re: [WiX-users] Saving existing xml file on uninstall and then merging it back in during reinstall The pattern I follow is to: 1) have a custom action read XPaths from a table and save what it finds in the existing file into properties; 2) re-write the XML file on install/upgrade with the values in those properties; It is certainly possible to do a source control like merge, but your custom actions are going to have to handle all the edge-cases. -- John Merryweather Cooper Build & Install Engineer -- ESA Jack Henry & Associates, Inc.(r) Shawnee Mission, KS 66227 Office: 913-341-3434 x791011 jocoo...@jackhenry.com www.jackhenry.com -----Original Message----- From: j2associates [mailto:j2associa...@yahoo.com] Sent: Friday, November 1, 2013 2:36 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Saving existing xml file on uninstall and then merging it back in during reinstall Hello all, We have a config file that is installed which can be customized post installation (not sensitive data). How can we save the config file during uninstall so that customizations can be merged into the new install. I was thinking along the following: A. During uninstall copy the config file to the user's Temp folder so if reinstall never happens it is no big deal B. During install, check the user's Temp folder and if the file is present, merge it and delete it Is this feasible, or is there a better way? In either case, can someone point me to some sample code? -- View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Saving-existin g-xml-file-on-uninstall-and-then-merging-it-back-in-during-reinstall-tp75902 17.html Sent from the wix-users mailing list archive at Nabble.com. ---------------------------------------------------------------------------- -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users NOTICE: This electronic mail message and any files transmitted with it are intended exclusively for the individual or entity to which it is addressed. The message, together with any attachment, may contain confidential and/or privileged information. Any unauthorized review, use, printing, saving, copying, disclosure or distribution is strictly prohibited. If you have received this message in error, please immediately advise the sender by reply email and delete all copies. ---------------------------------------------------------------------------- -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users