4

Is it possible to sequence a custom action before "LaunchConditions"?

This is my custom action:

<CustomAction
    Id="CA_vcAppRunning"
    BinaryKey="vcShowMsg"
    DllEntry="IsAppRunning"
    Return="check"
    Execute="immediate"/>

Sequenced in <InstallExecuteSequence/>

<Custom Action="CA_vcAppRunning" Before="LaunchConditions" />

I tried this, opened the MSI file in Orca and found that my custom action is sequenced at "99". But when I tried to install, it never got called.

I want to schedule this before LaunchConditions as this custom action is supposed to set a property which is used in the LaunchCondition (if the application is running, exit the installer/updater).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nocturnal
  • 55
  • 1
  • 8

1 Answers1

4

Don't schedule it in before LaunchConditions, schedule it after FindRelatedProducts and then add a second custom action that blocks install based on the results from your first CA.

This is the same method used to prevent downgrading in many tutorials, e.g.

<CustomAction Id="CA_BlockOlderVersionInstall" Error="!(loc.LaunchCondition_LaterVersion)" />
<InstallExecuteSequence>
        <LaunchConditions After="AppSearch" />
        <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
            <![CDATA[NEWERVERSIONDETECTED]]>
        </Custom>
</InstallExecuteSequence>
<InstallUISequence>
        <LaunchConditions After="AppSearch" />
        <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
            <![CDATA[NEWERVERSIONDETECTED]]>
        </Custom>
</InstallUISequence>
saschabeaumont
  • 22,080
  • 4
  • 63
  • 85
  • My custom action had to be changed to `Execute="immediate"` instead of `defered` otherwise I get a "error code is 2762" and only works during after InstallInitialize and before AfterInstall. – Jader Dias Jun 28 '13 at 01:57