How to execute Custom Action before RemoveExistingProducts with After="InstallValidate" in WiX
Asked Answered
M

1

7

I have something like this:

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>

Since one of the uninstallation fails i need to execute a Custom Action to solve the problem BEFORE RemoveExistingProducts. Something in the lines of:

<CustomAction Id="FixStuff" .. />

<InstallExecuteSequence>
  <Custom Action="FixStuff" Before="RemoveExistingProducts" />
  <RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>

This of course doesn't work since Custom Action cannot be before InstallInitialize. I'd really like to remove existing products between InstallValidate and InstallInitialize, but i'd like to execute FixStuff before removing existing products.

Is it even possible to do that?

Myel answered 21/12, 2010 at 16:15 Comment(0)
F
8

Unfortunately you cannot run an elevated custom action before RemoveExistingProducts with your current configuration.

Some possible approaches would be:

  1. Move RemoveExistingProducts right before InstallFinalize. This solves the custom action problem, but other problems may occur since this approach has many restrictions (the components need to maintain their names and GUIDs between versions, your custom actions should be aware that the upgrade is performed at installation end etc.).

  2. Create an EXE bootstrapper which fixes the old installer before launching the new MSI. This bootrapper can require Administrator privileges through a manifest:

http://msdn.microsoft.com/en-us/library/bb756929.aspx

  1. Repair the broken MSI by using this method:

    • fix the problem in the old MSI
    • create a BAT or EXE bootstrapper which recaches it through this command:

    msiexec /fv <path_to_msi>

    • distribute this MSI as an update before your new package

When your new package runs RemoveExistingProducts, the old cached MSI should be fixed and it should uninstall correctly.

Farquhar answered 23/12, 2010 at 7:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.