Getting Started With WIX (Windows Installer XML) in VS2012

Referred URL 
http://www.c-sharpcorner.com/UploadFile/cb88b2/getting-started-with-wix-windows-installer-xml-in-vs2012/

Introduction

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.

Advantages

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

To download WIX visit the link http://wixtoolset.org/ . 

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 Cab1.cab 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".

WinodowsInstaller2.jpg

It will look like this:

WinodowsInstaller3.jpg

Step 2 : Add Windows Installer Project 
WinodowsInstaller4.jpg

Now it will look like:

WinodowsInstaller5.jpg

Step 3: Add a reference of the WPF Application
WinodowsInstaller6.jpg

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.

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

WinodowsInstaller8.jpg

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: http://wix.sourceforge.net/manual-wix3/votive_project_references.htm. I have done that like this:

WinodowsInstaller9.jpg

Add Cab1.cab File inside the Package

When you build you WIX project it will create a Cab1.cab 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. 
WinodowsInstaller10.jpg
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.

WinodowsInstaller12.jpg

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 
WinodowsInstaller13.jpg
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
WinodowsInstaller15.jpg
Step 2: Add shortcut of our application with image 
WinodowsInstaller16.jpg

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 
WinodowsInstaller19.jpg

Step 3: Add shortcut component to Features 
WinodowsInstaller20.jpg

You May Also Like

0 comments