Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use CustomAction in WIX Bundle?

Tags:

wix

wix3.6

burn

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

like image 298
Isaiah4110 Avatar asked Oct 22 '12 19:10

Isaiah4110


People also ask

How do I install a package on WiX?

Open the Package Manager and select Installed Packages. Hover over the package and click the button. If there is an option to select Request Latest Version, the installed version is the latest version or a later version of the package has not been approved yet. Click Request Latest Version to open the request form.

What is WiX bundle?

A bundle is a collection of installation packages that are chained together in a single user experience. Bundles are often used to install prerequisites, such as the . NET Framework or Visual C++ runtime, before an application's .


2 Answers

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.

like image 83
ergohack Avatar answered Oct 20 '22 04:10

ergohack


As I see it, you have three options:

  1. Depending on what information you need, you can use the WixUtilExtension to perform simple tasks such as reading registry keys and performing file searches, which you can then pass the results to your installation packages as properties.

  2. Implement custom actions in the individual installation packages themselves (not in the bundle).

  3. Write your own custom bootstrapper application to determine all the properties you need to set, and then pass them to your installation packages. This is more complex than the #1 and #2, but if your interested the following links should get you started: introducing managed bootstrapper applications and write a wpf wix installer

like image 31
BryanJ Avatar answered Oct 20 '22 03:10

BryanJ