How to use CustomAction in WIX Bundle?

Isaiah4110 picture Isaiah4110 · Oct 22, 2012 · Viewed 11.7k times · Source

To give you a background - I have a 4 MSI's which comes from our vendor and this has to go to our company servers (we are looking at around 3500 servers). As of now, my counterparts are managing this using vbs, ps1 scripts. But the problem with the script is that everytime an update comes we have to worry about uninstalling the existing package before running the new one and a ton of hardcoding.

I want to automate the whole process (with very less hardcoding) by setting up a WIX script to package all the 4 MSI's together. I read about the WIX bundle and used that to create a single MSI. But now there are lot of a variables to be passed to the 4 MSI's, so I thought of using custom actions to set these variables based on the environment/machine where the MSI is running. But I cant make custom action to work? Am i missing something?

A little bit of googling and I saw something like there are no CustomActions in Bundle? can someone confirm?

Also if there are no CA's what are my options? how can I manipulate the variables to be passed on to the 4 MSI's? Most of them needs to be set based on the machine its being run (like install path, user id's, app pool id's etc).

Answer

ergohack picture ergohack · Dec 5, 2015

There is a fourth option, a useful lightweight hack, identified by Vijay Kotecha (see http://vijayskotecha.blogspot.com/2013/07/wix-bootstrapper-custom-action.html),...

Essentially, build an <ExePackage> around a pass-through .bat or .cmd batch file. The batch/command file contains the single line '%*' which re-executes all of the command line arguments as a first class command.

Thus:

<ExePackage ... SourceFile="SourcePath\WixCustomAction.cmd"
    InstallCommand="my_custom_action.exe my_custom_parameters" />
<ExePackage ... SourceFile="SourcePath\WixCustomAction.cmd"
    InstallCommand="my_next_action.exe my_next_parameters" />

Where WixCustomAction.cmd is a file containing only '%*'.

These <ExePackages> can be placed into the <Bundle><Chain> successively as needed using different InstallCommands as needed.