How to keep a config file when major upgrade in wix v3.8?

This solved it for me… config file is preserved with minor/major upgrade, and completely removed on uninstall.

Ref: Aaron Stebner: How to retain user-customized files during a Windows Installer major upgrade

EDIT: Summarized info from the linked page…

  1. Each config file shall have it’s own component, where the config file is marked as the keypath of the component. Unversioned file replacement logic will be used by the Windows Installer.
  2. Add “RemoveExistingProducts” action after the “InstallFiles” action. New versions of all components are installed before removing the old MSI. When it’s done in this sequence, the components will have their reference count incremented to 2, but the config files will not be replaced unless they are unmodified (because of unversioned file replacement logic). When the old MSI is removed, the reference count will be decremented back to 1, but the files will not be removed because the reference count are not 0.

Leave a Comment