3
votes

I have a strange problem with WIX installer. It has custom action preventing application to install when newer version present:

<Upgrade Id='SOME_GUID'>
  <UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
    Minimum='$(var.Version)' IncludeMinimum='yes'
    Maximum='$(var.Version)' IncludeMaximum='yes' />
  <UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
    Minimum='$(var.Version)' IncludeMinimum='no' />
</Upgrade>

<InstallExecuteSequence>
  <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
  <Custom Action='NoDowngrade' After='FindRelatedProducts'>NEWERFOUND</Custom>
<InstallExecuteSequence>

<CustomAction Id='AlreadyUpdated' Error='$(var.ProductName) has already been updated to $(var.Version) or newer.' />
<CustomAction Id='NoDowngrade' Error='A later version of $(var.ProductName) is already installed.' />

Nothing special - all as in WIX tutorial. I use Mondo UI with few own custom dialogs.

<UIRef Id="WixUI_Mondo" />

The problem is that custom action "NoDowngrade" executes after I click "Install" button, after all configuration steps passed. I expected to see the message immediately after launching installer. I checked the installExecuteSEquence in installer table using Orca util - "AlreadyUpdated" CA has Sequence = 27. FindRelatedProducts event have Sequence=25. 27 is used by other my action, "NoDowngrade", almost the same as "AlreadyUpdated". The first UI dialog should be displaied on Sequence = 49 I suppose - PrepareDlg has this value in InstallUISequence. Looks like nothing can happen between FindRelatedProducts and PrepareDlg showing except of my custom actions.

But surprisingly, installation log says opposite:

MSI (c) (90:88) [13:08:03:768]: Running UISequence
MSI (c) (90:88) [13:08:03:768]: PROPERTY CHANGE: Adding EXECUTEACTION property. Its value is 'INSTALL'.
MSI (c) (90:88) [13:08:03:768]: **Doing action: FindRelatedProducts**
Action 13:08:03: FindRelatedProducts. Searching for related applications
Action start 13:08:03: FindRelatedProducts.
FindRelatedProducts: Found application: {E25981A8-83D3-4183-B53C-F6E70FC9D1E0}
MSI (c) (90:88) [13:08:03:769]: PROPERTY CHANGE: Adding SELFFOUND property. Its value is '{E25981A8-83D3-4183-B53C-F6E70FC9D1E0}'.
Action ended 13:08:03: FindRelatedProducts. Return value 1.
MSI (c) (90:88) [13:08:03:770]: Doing action: PrepareDlg
--------------------
MSI (s) (2C:84) [13:08:10:658]: Running ExecuteSequence
MSI (s) (2C:84) [13:08:10:658]: **Doing action: FindRelatedProducts**
Action 13:08:10: FindRelatedProducts. Searching for related applications
Action start 13:08:10: FindRelatedProducts.
MSI (s) (2C:84) [13:08:10:660]: Skipping FindRelatedProducts action: already done on client side
Action ended 13:08:10: FindRelatedProducts. Return value 0.
MSI (s) (2C:84) [13:08:10:660]: Doing action: AppSearch
Action 13:08:10: AppSearch. Searching for installed applications
Action start 13:08:10: AppSearch.
MSI (s) (2C:84) [13:08:10:662]: Skipping AppSearch action: already done on client side
Action ended 13:08:10: AppSearch. Return value 0.
MSI (s) (2C:84) [13:08:10:662]: **Doing action: AlreadyUpdated**
Action 13:08:10: AlreadyUpdated. 
Action start 13:08:10: AlreadyUpdated.
APS DTE Axiom Server has already been updated to 12.1.1.1582 or newer.
MSI (s) (2C:84) [13:08:12:420]: Product: APS DTE Axiom Server -- APS DTE Axiom Server has already been updated to 12.1.1.1582 or newer.

Action ended 13:08:12: AlreadyUpdated. Return value 3.

So we can see that FindRelatedProducts tried to execute twice, but AlreadyUpdated CA executed only with second try. Tutorials doesn't say anything about placing this CA in InstallUISEquence. Is it needed, or maybe it is not a good approach if it isn't there? Or can you recommend a better solution to this problem?

2

2 Answers

3
votes

Repeat the InstallExecuteSequence section for the InstallUISequence as well. You want the checks to occur during the dialogs, so they're part of the InstallUISequence. You also want them to occur during InstallExecuteSequence in case the user does a quiet install, skipping the UI.

<InstallUISequence>
  <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
  <Custom Action='NoDowngrade'    After='FindRelatedProducts'>NEWERFOUND</Custom>
<InstallExecuteSequence>

<InstallExecuteSequence>
  <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
  <Custom Action='NoDowngrade'    After='FindRelatedProducts'>NEWERFOUND</Custom>
<InstallExecuteSequence>