Bundles-Wix vs. Advanced Installer

Written by Alex Marin · September 26th, 2019

#WIX #MSI


If you are in the software packaging business, you might have heard of WIX bootstrapper. This was released by Microsoft back in 2004, and it was the first ever open source license project for them.


Many people might not know this, but some big and popular packages from Microsoft were built with WIX, like Office 2007, Visual Studio 2005/2008, SQL Server 2005, and others.

But what is WIX? Well, WIX stands for Windows Installer XML, and unlike other software packaging tools that we are used to with a graphical interface, WIX uses a different approach when it comes to this. You can look at WIX more like a programming tool, because it uses XMLs, like in its definition, to declare and define what elements are inside a package and what exactly happens during an installation.

As with any other software out there, WIX has its strengths and weaknesses. The pros are:

  • It’s completely free
  • It has an active open source community
  • It has extensions; if not officially developed by Microsoft, you can find third-party community ones
  • Source control friendly; it means it’s easy to diff

Some of its cons are:

  • Steep learning curve. As we mentioned before, it doesn’t rely on UI; you must learn how to build a package using only wxs files which are basically XMLs
  • It’s Windows only

Bundles with WIX

WIX offers you the possibility to create an MSI from scratch using the wxs files, but for this article, let’s try to create a simple bundle of two MSIs.

First, we must get the latest WIX toolset from here. We are using the latest stable one at the moment, and that is 3.11.1.

After the installer is downloaded, double-click on it and install it as default. This adds all the files needed to work with WIX in %ProgramFiles(x86)\WiX Toolset v3.11\.

After that, we create two blank MSI’s and place them in a folder, for example, C:\WIXBundle. In the same folder, create a new text file and name it “bundle” with the wxs extension (bundle.wxs).

Open the text file in your desired editor and paste the following code:

<?xml version="1.0"? >
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Version="1.0" Manufacturer="Test" UpgradeCode="12345678-2222-3333-4444-211122222222">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
<Chain>
<MsiPackage SourceFile="C:\WIXBundle\example.msi"/>
<MsiPackage SourceFile="C:\WIXBundle\example2.msi"/>
</Chain>
</Bundle>
</Wix>     

As previously stated, this file has an XML structure, and there is certain required information that you must place in order to create a bundle.

First, we need to add a <Bundle > element. This MUST have the Version, Manufacturer, and UpgradeCode defined. In our case, we made the bundle Version 1.0, with a Test Manufacturer and a random UpgradeCode.

NoteNote: The UpgradeCode is for the entire bundle, and this must be different than the UpgradeCode present in the MSIs.

Every bundle requires a bootstrapper application to drive the engine. The <BootstrapperApplicationRef > element is used to refer to a bootstrapper that exists in WIX in order to create the bundle. If you have a specialized bundle which requires a custom bootstrapper app DLL, you must define the path to the DLL.

In our case we use the Standard Bootstrapper Application and this is defined in the file as:

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

Next, we add the chain of applications that we want to bundle. These can be added directly under the <Chain >element, or we can put a <PackageGroupRef >inside the chain to reference a shared package definition.

WIX supports the following chained package types:

Because we use MSIs, we go with the MsiPackage type in the XML and specify only where the source files are present, leaving all the other attributes as default.

Now that we have the bundle configured as desired, we must build it. In the same folder with the bundle.wsx file, create a new batch file and save it as makebundle.bat.

Inside the batch file paste the following code:

"C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" bundle.wxs -ext WixBalExtension
"C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" bundle.wixobj -ext WixBalExtension
@pause

As you can see, we have two lines in our batch file. The first line is targeting candle.exe, which is the WIX compiler. This generates an object file (bundle.wixobj) in your folder.

The second line is for light.exe, which is the WIX linker. This generates the final installer (exe) based on the object (wixobj) created previously.

Because we are building a bundle, the WixBalExtension must be provided as an argument in both phases, in other cases (building an MSI, etc) this is not needed.

Once you have everything ready, double-click the makebundle.bat. This should be a quick build and, in the end, the bundle.exeappears in the folder.

Cmd

And there you have it, our own bundle created with WIX.

Double-click the newly created bundle.exe and install it.

Setup

If you want to install your newly created bundle silently, you can use the q, quiet, s, or silent parameters:

Bundle.exe /s

Bundles with Advanced Installer

We have a more in-depth article regarding creating Suite(bundled) applications using Advanced Installer that can be found here.


In this case, we’ll go shortly over the quick process that Advanced Installer offers you and its pros. Once you created a new Enterprise project and entered the product details (Product Name, Product Version, etc.), navigate to the Prerequisites page.

Once here, we can add the two example MSIs as Feature-based prerequisites like so:

  • Right-click Feature-based and select New Package Prerequisite
  • Browse to your MSI and select it. Advanced Installer automatically detects the name and version of the MSI.
  • Select the Setup Files tab from the right and scroll down to Install Command Lines
  • In our case, everything is silent, so we write /qb in all of the three cases of install (Full UI, Basic UI, Silent (no UI)
  • Select Install Conditions tab and check Always Install Prerequisite
  • Repeat the same process for the second MSI
  • Go to the Builds page and select what type of Suite you want Advanced Installer to create. You can also choose the extract location for your files.

The resulted bundle.exe can also be executed silent using the “/qb” parameter. For example, bundle.exe /qb

It’s no argues that WIX is a great powerful toolset.It’s made its case with complex applications released by Microsoft and other software manufacturers during the years, but it’s not meant for beginners or those that want to save time.

This is a tool for developers with a lot of Windows Installer background that know what they are doing and prefer spending their time on tweaking the installer source code, instead of the app their packaging.

Advanced Installer offers the same functionality as WIX, even more in some cases, but with its powerful and modern GUI you can create installation suites in minutes, save time on training new colleagues how to use it and it also stops you from crippling your installer with incorrect configurations.

Subscribe to Our Newsletter

Sign up for free and be the first to receive the latest news, videos, exclusive How-Tos, and guides from Advanced Installer.

Comments: