Major Upgrades and config files are common component parts of an software.
Declaration for the major upgrades:
<MajorUpgrade DowngradeErrorMessage="A newer version of $(var.AppName) is already installed." AllowSameVersionUpgrades="yes" />
While doing major upgrades, a config file should not be removed and not be overwritten. The config file hast to stay. That is realized with the following declaration:
<Component Id="MyConfigComponent" NeverOverwrite="yes" Permanent="yes" Guid="MY-GUID-HERE">
<File Id="MyConfigOutput" KeyPath="yes" Name="MyConfig.config" Source="..\MyApp\MyConfig.config.bak"/>
</Component>
How can I remove the file MyConfig.config
on uninstall?
Using a declaration like <RemoveFile On="uninstall" Name="MyConfig.config" ... >
removes the config file on an Upgrade. Therefore, it cannot be used for this purpose. The same applies to RemoveFolderEx
. What have I to use instead?