Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make sure FindRelatedProducts runs after the UI was shown using WiX?

I have a MSI installer and I specify per-machine installation in the installer UI. Previous version was also installed per-machine.

However, FindRelatedProducts reports that current install is per-user.

MSI (c) (A4:F0) [13:33:20:490]: FindRelatedProducts: **current install is per-user**. Related install for product '<<my guid>>' is per-machine. Skipping...

From the log I can see that ALLUSERS property is created only after FindRelatedProducts ran (note timestamp):

MSI (c) (A4:A8) [13:33:25:032]: PROPERTY CHANGE: Adding ALLUSERS property. Its value is '2'.

The property ALLUSERS is Published from the UI based on what the user selected:

      <Publish Property="ALLUSERS" Value="2"><![CDATA[FolderForm_AllUsers="ALL" AND VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1]]></Publish>
      <Publish Property="ALLUSERS" Value="{}"><![CDATA[FolderForm_AllUsers="ME" AND VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1]]></Publish>


    <Control Id="AllUsersRadioGroup" Type="RadioButtonGroup" X="20" Y="175" Width="342" Height="42" Property="FolderForm_AllUsers" Text ="empty">      
      <RadioButtonGroup Property="FolderForm_AllUsers">
        <RadioButton Value="ALL" X="0" Y="0" Width="342" Height="17" Text="$(loc.InstallForAll)" />
        <RadioButton Value="ME" X="0" Y="18" Width="342" Height="17" Text="$(loc.InstallForMe)" />
      </RadioButtonGroup>

      <Condition Action="show"><![CDATA[VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1]]></Condition>
      <Condition Action="hide"><![CDATA[NOT (VersionNT>=400 AND Privileged=1 AND FolderForm_AllUsersVisible=1)]]></Condition>
    </Control>

As a result, the new version is installed alongside the existing (two entries exist in Add/Remove programs).

<InstallUISequence>
  <Custom Action="VSDCA_FolderForm_AllUsers" After="IsolateComponents"><![CDATA[Installed="" AND NOT RESUME AND ALLUSERS=1]]></Custom>
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>


<InstallExecuteSequence>
  <!-- Only schedule this custom action for the 32-bit MSI.  -->
  <?if $(var.DependenciesPlatform)=x86 ?>
  <Custom Action="CA_Err32BitMsiOn64BitOS" After="LaunchConditions">
    <![CDATA[MsiAMD64 OR Intel64]]>
  </Custom>
  <?endif ?>

  <!-- Prevent downgrading -->
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>

  <RemoveExistingProducts Before="InstallInitialize" />

  <Custom Action="LaunchApp" After="InstallFinalize" />

  <InstallInitialize></InstallInitialize>
  <RemoveShortcuts></RemoveShortcuts>
  <InstallFiles></InstallFiles>
  <CreateShortcuts></CreateShortcuts>
  <InstallFinalize></InstallFinalize>

  <ScheduleReboot After="InstallFinalize"/>
</InstallExecuteSequence>

This occurs only in case both versions of the app are installed per-machine, since FindRelatedProducts apparently assumes per-user installation (because it runs before the user was able to pick one of the radio buttons and therefore there is no ALLUSERS propety set at the time it runs).

How do I ensure that FindRelatedProducts is executed only after ALLUSERS was Published from the UI as specified by the user?

like image 301
Marek Avatar asked Apr 03 '14 11:04

Marek


1 Answers

I found I need to add the following to ensure FindRelatedProducts runs within the UI after the user made his choice:

<Publish Event="DoAction" Value="FindRelatedProducts">1</Publish>

From https://www.mail-archive.com/[email protected]/msg22960.html

I found it is not strictly needed to use the suppress attribute - it seems to work also without explicitly suppressing the action in the InstallUISequence.

like image 158
Marek Avatar answered Oct 14 '22 09:10

Marek