Wednesday, August 6, 2014

Getting Started With WIX (Windows Installer XML) in VS2012

Referred URL


The Windows Installer XML (WiX) is a toolset that builds Windows installation packages from XML source code. The toolset supports a command line environment that developers may integrate into their build processes to build MSI and MSM setup packages.


The WiX toolset provides the following advantages over other popular Windows Installer developer tools:
  • WiX offers unrestricted access to Windows Installer functionality.
  • It leverages XML-based source files, that can easily be edited in any text editor and are easily version controlled.
  • The command-line interface allows WiX to be integrated into any automated application build process or continuous integration environment.
  • There is no need to get expensive licenses for special tools. The WiX toolset is free.

To download WIX visit the link . 

After Installing (WIX) we have Wix Template In Vs2012WinodowsInstaller1.jpg

To create a setup of an application we need to do the following:
  1. Create a WPF application project in the solution.
  2. Create a new Wix project solution.
  3. Add a reference to the WPF Application into the WIX project.
  4. Configure the installation XML (*.WXS) file using the following procedure:

    o Add the WPF project to the *WXS File
    o Add the File to the Package.
    o Create a folder in Program Files and Folders
    o Create a folder in the Program Menu for Program menu shortcut
    o Create a folder on the Desktop
Step 1: Add new WPF Application

Use "New" -> "Project..." ->"WPF Application project".


It will look like this:


Step 2 : Add Windows Installer Project 

Now it will look like:


Step 3: Add a reference of the WPF Application

Right-click on the reference of the of the WIX project and add the WPF Project.

Step 4: Configure the installation of the XML file (*.WXS)
While you see the *.wxs file it has some predefined code written in XML. It has various properties and tags for these things, you need to 
the following:
It will explain all the properties in detail and you can get a practical example from here.

Note: You must provide the new GUID where I have "Your-Guid-". You can do that very easily from Visual Studio.

Click on "Tools" and click on "Create GUID"; it creates a new GUID every time.

Use the new GUID by just clicking on the "Copy" button and paste it wherever you want the GUID.


Add WPF project to the *.WXS File

We need to give a reference of the WPF Application project in the *.WXS file. So that we can use the variables of the WIX you can see this on the link and in: I have done that like this:


Add File inside the Package

When you build you WIX project it will create a file and a *.setup so if we need only one single file for the setup add that time we need to add that file to our setup file. 
Create Folder in Program Files FoldersWinodowsInstaller11.jpg

Create Folder in Program Menu for Program menu shortcut
In the start menu we can create a folder and inside the folder we can provide our application. To do that we need to do 3 steps.


Step 1: Create Program Menu Folder

It will create a folder named "My System Pvt Ltd " in the Start Menu.

Step 2: Add shortcut of our application with image 
You can use any *.ico file ,add that file to the WIX project.

Step 3: Add shortcut component to FeaturesWinodowsInstaller14.jpg

We are telling you that you need to add this shortcut to the installer.

Create shortcut on Desktop

If you need to add a shortcut to the Desktop then we need to use the same steps as we did for creating the shortcut in the Startup Menu or Program Menu. 

Step 1: Create Desktop Folder
Step 2: Add shortcut of our application with image 

Step 3: Add shortcut component to Features WinodowsInstaller17.jpg

Add the Application to the Startup Folder (When the user is logged into the application it starts automatically)

If you want to put your application in the Startup folder then you can do that as you have done for the Program Menu shortcut and Desktop shortcut.

Step 1: Create Startup FolderWinodowsInstaller18.jpg

Step 2: Add shortcut of our application with an image 

Step 3: Add shortcut component to Features 

No comments: