Installing Prerequisites Using WIX Bootstrapper Project and Other Features of WIX

This article will show you some features of the Windows Installer XML, such as:

NOTE: If you are new to Windows Installer XML than please refer to my article Getting Started with WIX; here is the link:


Why use a WIX Bootstrapper project?

In our project there are so many things that we need to install before our software will be installed. At that time we can use this to bundle the prerequisites (like .Net Framework, SQL etc.) of Software or Website. Using this we can put all the necessary things into a single package so it is easy to manage.

How to add a prerequisites to the project


Add Bootstrapper Project to Solution

To add a new Bootstrapper project to Visual Studio 2012:



Figure 1: Add Bootstrapper Project

Create Package Group

Here we have two options that :

  • We can install prerequisites from our setup file
    We can download from internet than install file

Install Prerequisites from our setup file

Note: In the "WixDemoWPFAppVS2012.rar" file I have not added "dotNetFx40_Full_x86_x64.exe". Since it is greater than 10 MB in size and I cannot upload the file. Please download it and add that into you project as I have explained in the article.
In this example we will install the .Net Framework 4.0 Full as a prerequisite. You can download that from the link:

After downloading we need to add that "dotNetFx40_Full_x86_x64.exe" to our Bootstrapper project.

Copy the downloaded file, do the right-click on the bootstrapper project and just paste it.


Figure 2: Copy and Paste the File

Now create a <packageGroup> in the <Fragment> and now in the package Group we have an <Exepackage> element. To understand all the properties please refer to this link:


Figure 3: ExePackage Element

SourceFile: Location of the package to add to the bundle. The default value is the Name attribute, if provided. At a minimum, the SourceFile or Name attribute must be specified.

Compressed: Whether the package payload should be embedded in a container or left as an external payload.

This will add our .Net Framework 4.0 exe to the setup file.

Search Registry

Before installing .Net Framework 4.0 we will determine whether it is already installed; if it is not then we will install it.

To do that we need to search the Registry Values and to do that we need to do add a reference of WixUtilExtention.dll to our project.


Figure 4 Add WixUtilExtension.dll

Add that file to the <WIX> element:


Figure 5: Add UtilExtension to Wix element

Now search the Registry values:


Figure 6: Search Registry

Add the package to the chain.

Now we have added that package to the Chain.


Figure 7: Add Package to Chain

We can download from the internet then install the file.

Note: Though we are downloading the file from the internet while setup is running but at the time of the build the project we need to add that file to the solution.

To download it from the internet we need to add a property DownloadURL and Compressed.


Figure 8: add DownloadUrl Property

It will not add a source file to the setup file but when installation is running and it will not find .Net Framework 4.0 in the system then it will download it from the given link.

In both ways you can specify ExePackage, then all the steps are same. We can use this for installing any .exe file.

Note: Add your *.msi file to the Bootstrapper project and add the reference of the setup project to the Bootstrapper project.

Add a reference of the setup project to the Bootstrapper project.


Figure 9: Add setup project to the Bootstrapper project

Add WixDemoWPFAppVS2012.Setup.msi file to the Bootstrapper project:

Add-WixDemoWPFAppvs2012-setup..msi file-to-project.jpg

Figure 10: Add WixDemoWPFAppvs2012.setup..msi file to project

Now just build your Bootstrapper project and open the bin folder and run the setup.

Creating Database

Note: We will add these things to our product.wxs (see the Figure 11). I have explained about that file in my previous article. The database will not be added to the Bootstrapper (bundle.wxs) project.

You can get Product.wxs from the link:

Or you can get that file in the .rar file of this article.


Figure 11: Product.wxs file

To create a database in SQL we can use this procedure:

  1. Add the reference of the two files in our solution:

    • WixUtilExtension.dll
    • WixSqlExtension.dll
  2. Create a database user
  3. Add the *.sql file to create the database

Add a reference of the two files in our solution:


Figure 12: Add SQL and Util Extension DLL Files

Add that DLL file to the Product.wxs file:


Figure 13: Add the DLL files to the Product.wxs File

Create a database user and add a *.sql file:


Figure 14: Create Database User

We need to provide the CreateTable.sql file in the solution. To do that just copy that file and paste it to the solution.


Figure 15: Add CreateTable.sql

Add a new component for the database:


Figure 16: Add New Database component

Add that component to the features.


Figure 17: Add Component to the Feature

Now just build you project and run the setup file; it will create a database with a table.

Creating Uninstall Shortcut

This shortcut is used to uninstall the application and its data it will be created in the Program Menu Folder.


Conclusion: we can use WIX to install perquisites and create databases; we can do that very easily using WIX.

If this article helps you than please let me know by your comments.