I am trying to run a custom action before my application gets upgraded or uninstalled ( Before the files are removed as I have to copy a database file to another directory )
Problem - I am able to run it when I uninstall it from control panel but I am unable to do so when I Upgrade it.On upgrading the setup is getting ended prematurely and the old version is also getting removed.
Here is my code -
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed."/>
<Binary Id="secondAction" SourceFile="..\Migrations\bin\Debug\Migrations.CA.dll" />
<CustomAction Id="secondActionId"
BinaryKey="secondAction"
DllEntry="Migrate"
Execute="deferred"
Return="check" />
<InstallExecuteSequence>
<Custom Action="secondActionId" Before ="RemoveFiles">(REMOVE~="ALL") OR (WIX_UPGRADE_DETECTED)</Custom>
</InstallExecuteSequence>