Let us learn Windows Installer XML (WIX) - Step by Step

Posted by in .NET Framework category on for Beginner level | Points: 250 | Views : 9452 red flag
Rating: 4 out of 5  
 1 vote(s)

In this article we will learn about Wix

 Download source code for Let us learn Windows Installer XML (WIX) - Step by Step


Windows Installer XML (WIX) is a free tool that is use for making Windows installation packages from XML source code.

Straight to Usage

Step 1

Download Wix from here

Step 2

If we are using Dotnet 2005, then we need to download one small COM component i.e. ProjectAggregator2.msi. Without this, we cannot install Votive – Wix project and editor package for Visual Studio.

If we want to install Wix first without installing ProjectAggregator2.msi, we will receive the following error message

Note: This is only required for Visual Studio 2005 and not for Visual Studio 2008.

Step 3

Install ProjectAggregator2.msi first

Step 4

Install Wix. Click on the exe file

The below window will appear

If you want change the location of your installation file, you can do so by clicking on the Advanced button

Step 5

Click on the Install button

Step 6

After successful installation,the below screen will appear

Step 7

Now let us create a simple WPF application - A Calculator in WPF. The only thing that we will do is we will make a dll file where the business logic will be encapsulated and one picture will be there which will act as a resource file.

Step 8

So let’s first create a Class library project.

The logic is very simple as expected

public class OurCalciClass
	public int MathOperation(int firstNum, int secondNum, string ops)
		int result = 0;
		switch (ops)
			case "+": result = firstNum + secondNum; break;
			case "-": result = firstNum - secondNum; break;
			case "*": result = firstNum * secondNum; break;
			case "/": result = firstNum / secondNum; break;
		return result;

And after compilation, our dll (CalculatorLogic.dll) is ready

Step 9

Now let’s make a simple UI for the Calculator in WPF. So let’s choose the WPF Application template.

Click on OK and make the following design.

Next add a reference to the CalculatorLogic.dll in the project.And then write the code

private void btnAdd_Click(object sender, RoutedEventArgs e)
	txtResult.Text = Result("+");
private void btnSub_Click(object sender, RoutedEventArgs e)
	txtResult.Text = Result("-");

private void btnMul_Click(object sender, RoutedEventArgs e)
	txtResult.Text = Result("*");

private void btnDiv_Click(object sender, RoutedEventArgs e)
	txtResult.Text = Result("/");

private string Result(string ops)
	return (objOurCalciClass.MathOperation(Convert.ToInt32(txtNum1.Text), Convert.ToInt32(txtNum2.Text), ops).ToString());

And running the application will yield the desired answer

Step 10

Now it’s time for adding a project installer. So click on File - > New - > Project. For Project templates, choose WIX as project type and select WIX Project as the project template.

Step 11

After clicking on the OK button, the following screen will appear

Step 12

We need to add the Calculator.exe file to the installer. For doing so, we need to uncomment the Component tag.

And has to add the following

<Component Id="ProductComponent" Guid="19685467-f935-4210-a585-a51f9beda693"> 
<!-- TODO: Insert files, registry keys, and other resources here. -->

<File Id ="CalculatorExe" Source ="C:\CalciUI\CalculatorUI\CalculatorUI\bin\Debug\CalculatorUI.exe"></File>
<File Id ="MyPic" Source ="C:\niladri_biswas.jpg"></File>
<File Id ="CalculatorLogicDll" Source ="C:\CalciLogic\CalculatorLogic\CalculatorLogic\bin\Debug\CalculatorLogic.dll"></File>

That means for every resources added to the project, we need to specify those in the File element.

Step 13

Next if we want to compile, we will encounter an error

Error 1 Found orphaned Component 'ProductComponent'. If this is a Product, every Component must have at least one parent Feature. To include a Component in a Module, you must include it directly as a Component element of the Module element or indirectly via ComponentRef, ComponentGroup, or ComponentGroupRef elements. C:\FirstWixProject\CalculatorWixProject\CalculatorWixProject\Product.wxs 13 1 CalculatorWixProject

For eliminating this error, remove the comment around ComponenRef element

Step 14

Build the project. If everything goes smoothly i.e. successful build, then in the Debug directory we will find the MSI installer.

Step 15

Click on that.

Then go to C:\ProgramFile\CalculatorWixProject

Run that.


  1. Wix Tutorial
  2. Wix
  3. Windows Installer XML (WiX) toolset
  4. Creating an installer using Wix v3.0, Votive, and Visual Studio 2005/2008
  5. Creating an installer using Wix v3.0, Votive, and Visual Studio 2005/2008 - Part 2, the GUI


Hope this step by step article has given te right direction and how to start working with Wix.All the experiment files are attached herewith.Thanks for reading.

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Niladri Biswas
Member Level: Platinum
Member Status: Member
Member Since: 10/25/2010 11:04:24 AM
Country: India
Best Regards, Niladri Biswas
Technical Lead at HCL Technologies

Login to vote for this post.

Comments or Responses

Posted by: Learningtorise on: 5/9/2013 | Points: 25
Beautifully Explained with screenshots! Can we create installer for projects built using ASP.Net ?

Login to post response

Comment using Facebook(Author doesn't get notification)