I've implemented my first MSI-Installer with WIX-Toolset 3.6
which includes Custom Actions for Backup
, Installation
and Rollback
.
The Backup and Installation works fine, but I have a problem with my Rollback Custom Action. I have defined my Custom Actions like this:
<!-- Custom actions -->
<CustomAction Id="CA_Install" Return="check" BinaryKey="BIN_CaLibrary" Execute="deferred" DllEntry="CaInstall" />
<CustomAction Id="CA_Rollback" Return="check" BinaryKey="BIN_CaLibrary" Execute="rollback" DllEntry="CaRollback" />
<CustomAction Id="CA_Backup" Return="check" BinaryKey="BIN_CaLibrary" Execute="immediate" DllEntry="CaBackup" />
<CustomAction Id="CA_SetTargetDir" Return="check" BinaryKey="BIN_CaLibrary" Execute="immediate" DllEntry="CaSetTargetDir" />
<CustomAction Id="CA_SetTargetDirAndInstallTypeForInstall" Return="check" Property="CA_Install" Value="InstallType=[INSTALLTYPE];TargetDir=[TARGETDIR]" />
<CustomAction Id="CA_SetTargetDirForRollback" Return="check" Property="CA_Rollback" Value="TargetDir=[TARGETDIR]" />
<!-- Linking custom actions to the install sequence -->
<InstallExecuteSequence>
<Custom Action="CA_SetTargetDir" Before="AppSearch" />
<Custom Action="CA_Backup" After="CA_SetTargetDir" />
<Custom Action="CA_SetTargetDirForRollback" Before="CA_Rollback" />
<Custom Action="CA_SetTargetDirAndInstallTypeForInstall" Before="CA_Install"/>
<Custom Action="CA_Rollback" Before="CA_Install"/>
<Custom Action="CA_Install" Before="InstallFinalize" />
</InstallExecuteSequence>
In my CA_Backup
I always create a Backup-Directory with the old version of the application (even if the installation is successful). When my CA_Install
runs into an exception the Installer jumps to my own Rollback Custom Action CA_Rollback
. In this Custom Action I delete all files in TARGETDIR
and reproduce the files from Backup-Directory. It does exactly what it should do but after the CA_Rollback
the Wix-Installer automatically rollback the other Custom Actions like InstallFiles
. And so it deletes all the files that are reproduced from the Backup-Directory in my CA_Rollback
before.
Is it possible to disable the automatic rollback of the InstallFiles
Custom Action? Or is there an other solution for my problem?
It's also strange that the ProgressText of the CA_Rollback is not what I've defined, but the standard text of WiX-Framework.
<ProgressText Action="CA_SetTargetDir">Getting Installation-Type...</ProgressText>
<ProgressText Action="CA_Backup">Creating Backup-Directory...</ProgressText>
<ProgressText Action="CA_Install">Updating Application...</ProgressText>
<ProgressText Action="CA_Rollback">Rollback the Application...</ProgressText>
So, when the Installer jumps to the CA_Rollback the ProgressText is NOT "Rollback the Application..." but in the other Custom Actions (CA_SetTargetDir, CA_Backup, CA_Install) the ProgressText is shown as defined.
EDIT:
I've found the DisableRollback Action and I'd like to used it like this in my InstallExecuteSequence
:
<DisableRollback After="CA_Rollback" />
So I'd like to run my own Rollback CA_Rollback
, but want to disable the automatic rollback of the other Custom Actions. But when I include this, there is no Rollback at all.