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>