2

I want to keep a config file when on upgrading but remove it on uninstalling.

<Directory Id="CommonAppDataFolder">
        <Directory Id="dir_99306542_9959_46A2_9928_91FA5A0112C0" Name="ProofpointPlugin">          
          <Component Id="comp_22FC069D_8417_4504_9F0F_4F01DD04C6C8" Guid="E0CC1916-F33F-48DC-8677-5FF077722114">
            <RemoveFile Id="remove_config_file" Name="config.json" On="uninstall"/>
            <Condition>(REMOVE=ALL) AND (NOT UPGRADINGPRODUCTCODE)</Condition>
          </Component>
        </Directory>
      </Directory>

And I have this to facilitate upgrades

<RemoveExistingProducts After='InstallInitialize'></RemoveExistingProducts>
  • Too busy, but I'll try to lob you some links instead: [**1: preserve config**](https://stackoverflow.com/a/53586960/129130) and [**2: settings management**](https://stackoverflow.com/a/48196886/129130). Plenty of further links in those main links. And finally [**do read this answer**](https://stackoverflow.com/a/49142733/129130) from MSI Expert Chris Painter. – Stein Åsmul Apr 08 '19 at 23:55
  • [One more link](https://stackoverflow.com/a/48651809/129130). Some things you should know about file settings preservation, file overwrite and file reversion (uninstall and reinstall of file rather than overwriting). – Stein Åsmul Apr 09 '19 at 00:03
  • On a side note, a `Component` condition will only be evaluated at installation time. It can't be used to conditionalize the removal of a file. You are effectively saying "Install this component, which is used for removing this file, only during uninstall". Well, you can't install anything during uninstall, which is the reason this doesn't work. – zett42 Apr 09 '19 at 15:40

0 Answers0