How to execute custom actions sequentially in WIX - wix

I have 2 custom actions in WIX A and B
I need B to execute only after A is finished.
A is an external exe, B is a set of commands which configures A, and therefore cannot execute before A.
Currently I define 2 custom actions like this:
<CustomAction Id='install_exe_action' FileKey='exe' Execute='deferred' Return='check' ExeCommand=' --flags 1'/>
<CustomAction Id='start_service_controller_action' FileKey='exe_service_controller_exe' Impersonate='no' ExeCommand=' /install ' Execute='deferred' Return='check' />
I then have 2 InstallExecuteSequence sections like:
<InstallExecuteSequence>
<Custom Action='install_exe_action' After='InstallFiles'> NOT Installed AND NOT REMOVE </Custom>
</InstallExecuteSequence>
<InstallExecuteSequence>
<Custom Action='start_service_controller_action' After='InstallFiles'> NOT Installed AND NOT REMOVE </Custom>
</InstallExecuteSequence>
How can I get start_service_controler_action to only happen AFTER install_exe_action?
Thanks!

<InstallExecuteSequence>
<Custom Action='install_exe_action' After='InstallFiles'> NOT Installed AND NOT REMOVE </Custom>
<Custom Action='start_service_controller_action' After='install_exe_action'> NOT Installed AND NOT REMOVE </Custom>
</InstallExecuteSequence>

Related

Wix - Run Batch File on Uninstall

So This CustomAction already work only for RunBatch ID, Running When Before Finalize Install. But It didn't work for uninstall, did i miss something ?
<CustomAction Id="RunBatch" ExeCommand="[INSTALLFOLDER]Tester.bat" Directory="INSTALLFOLDER" Execute="deferred" Return="asyncWait" />
<CustomAction Id="Uninstall" ExeCommand="[INSTALLFOLDER]Tester.bat" Directory="INSTALLFOLDER" Execute="deferred" Return="asyncNoWait"/>
<InstallExecuteSequence>
<Custom Action="RunBatch" Before="InstallFinalize">NOT Installed</Custom>
<Custom Action="Uninstall" Before="RemoveFiles">Installed</Custom>
</InstallExecuteSequence>
When I Run Uninstall from Installer or even control panel, batch file still not running...
I Fix It After Change
<Custom Action="Uninstall" Before="RemoveFiles">Installed</Custom>
to
<Custom Action="Uninstall" After="InstallInitialize">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>

Two simultaneous EXE files running WiX

I have two custom actions running two EXE files. But they get extracted at the same time and the processes block each other during install. How do I schedule them one after the other?
<CustomAction Id="StartAppOnExit1"
FileKey="UMIEXE"
ExeCommand=""
Execute="deferred"
Return="asyncNoWait"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="StartAppOnExit1"
Before="InstallFinalize">$UMIEXE=3</Custom>
</InstallExecuteSequence>
<CustomAction Id="StartAppOnExit2"
FileKey="Python"
ExeCommand=""
Execute="commit"
Return="check"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action ="StartAppOnExit2"
After="StartAppOnExit1" >$Python=3</Custom>
</InstallExecuteSequence>
Here is my code, but I seem to be getting an error with what you told.
In product.wxs sequence them one after another and in custom action have a check to validate that the exe is executed and hold the process there only
<Custom Action="FirstCustomAction" After="InstallFinalize">NOT INSTALLED AND NOT REMOVE</Custom>
<Custom Action="SecondCustomAction" After="FirstCustomAction">NOT INSTALLED AND NOT REMOVE</Custom>
in CustomAction
WaitForExit() in process call.

wix - no rows with my CA in InstallExecuteSequence Table

i have code like this
<Fragment>
<CustomAction Id="IsPrivileged" Error="You should be an adminuser" />
<InstallExecuteSequence>
<Custom Action="IsPrivileged" Before="LaunchConditions">Not AdminUser</Custom>
</InstallExecuteSequence>
<CustomAction Id="install_myfile" FileKey="id_myfile.exe" ExeCommand="/install" Return="check"/>
<InstallExecuteSequence>
<Custom Action="install_myfile" Sequence="5750"/>
</InstallExecuteSequence>
</Fragment>
But installer ignores this fragment. i looked the msi-database with Orca.exe. and i found that in InstallExecuteSequence Table there are no rows with this custom actions. what is the problem? should i bind my custom actions to dialog's controls?
Use CustomActionRef to reference the Fragment into your Product.

Sequencing a custom action in WiX before "LaunchConditions"

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).
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>

How To Run the Installed Application After Setup in Wix?

I want to execute the application, I have upgraded.
http://wix.sourceforge.net/manual-wix3/run_program_after_install.htm does not work for me as I do not have an Exit dialog.
<InstallExecuteSequence>
<Custom Action="LaunchApplication" OnExit="success">CLIENTUILEVEL = 2 AND NOT Installed</Custom>
<InstallExecuteSequence>
where Custom action LaunchApplication will execute to open the application.
In WiX 3.8, the only way I've found to do this is
<CustomAction Id="LaunchFile" FileKey="..." ExeCommand="" Return="asyncNoWait" />
<InstallExecuteSequence>
<Custom Action="LaunchFile" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
Which triggers after the "Install" button in the UI, and before the "Finish" button. Also works fine in /quiet mode.