How to force WiX to delete if there is an error in CustomAction

I have the following CustomAction:

<CustomAction Id="ActionName"
              After="InstallFinalize">
  <![CDATA[NOT Installed AND (VSTORUNTIME4="#1")]]>
</CustomAction>

The problem is that there is a case in CustomAction when I return ActionResult.Failure. In this case, the installer will display an error message and say that the installation failed, but the application is still partially installed (the files are already in the program files, and the application is displayed in the uninstall programs).

I want the return of ActionResult.Failure the installation to be aborted and deleted. This is what happens if a custom action fails when installing the default Visual Studio installer, and I think that makes more sense.

Does anyone know how to invoke uninstall if a custom action fails? Do I need to add something extra to WiX XML?

+3
source share
3 answers

Your custom action is currently scheduled after the completion of the installation transaction (After = "InstallFinalize"). The only custom actions that you can drop are “pending” user actions that are scheduled between “InstallInitialize” and “InstallFinalize”. For your pending user actions, you should also schedule a rollback before it.

+7
source

Windows Installer, by default, supports transactional history with the ability to undo all changes in the system. The question is what actions are you doing and where / how are they planned?

CustomActions , , , .

:

In- Script Windows

Zataoca:

Zataoca: .

Zataoca: ( ) .

+2

, , "" , , no-zero, .

what you need to do is make sure your value does not return a null value on error.

            ExeCommand = "[INSTALLLOCATION] BeforeUnstall.bat" Execute = "deferred" Return = "check" HideTarget = "no" Impersonate = "no" / ">

0
source

Source: https://habr.com/ru/post/1791600/


All Articles