Comments

1 comment

  • Avatar
    Jake

    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>:

    <project>
        ...
        <preUninstallationActionList>
            <actionGroup>
                <!-- Executing two actions as if they were one -->
                <actionList>
                    <showWarning>
                        <text>InstallBuilder is running, aborting installation.</text>
                    </showWarning>
                    <exit></exit>
                </actionList>
                <ruleList>
                    <!-- This rule is currently supported for Linux, Windows and OSX only. Checking if "builder" is running will not work for Windows -->
                    <processTest>
                        <name>builder</name>
                    </processTest>
                </ruleList>
            </actionGroup>
        </preUninstallationActionList>
        ...
    </project>
    

Please sign in to leave a comment.