How can I abort the uninstallation if a pre-uninstall action fails?



1 comment

  • Avatar

    If an action inside the <preUninstallationActionList> fails, you will notice the uninstallation continues. In the same fashion, if you execute a <throwError> action during the uninstallation it will have no effect.

    This behavior is being caused by a "feature": uninstallers ignore errors in case any action fails, including the <throwError> action (which will ignored by the uninstaller). The reasoning behind this behavior is that unlike an installer, the uninstaller should never fail (for example, because the user may have already manually deleted some files).

    One possible workaround you can use to abort the uninstallation is to combine <showWarning> and <exit> actions to emulate the behavior of <throwError>. The following snippet combines both actions inside an <actionGroup>:

                <!-- Executing two actions as if they were one -->
                        <text>InstallBuilder is running, aborting installation.</text>
                    <!-- This rule is currently supported for Linux, Windows and OSX only. Checking if "builder" is running will not work for Windows -->
    Comment actions Permalink

Please sign in to leave a comment.