Wednesday, 12 June 2013

How to create .Net-based Installer Using WiX

            The Windows Installer XML (WiX) is a toolset that builds Windows installation packages from XML source code.WiX is an open source project.You can download the latest toolset from here Windows Installer XML (WiX). 

You can create .msi file, .msu file and also create .exe file using WiX project.

How to create Simple installer?

Ans:-
 Create simple setup and its functionality using visual studio 2010  Create new project of wix after install wix toolset. Then open new project, you can see here Windows Installer XML in Installed templet select setup project...and give suitable name. 


  1. And your project contain default page product.wxs you can add it contain this                            
    default code............                                       
  2.  Now add your manufacture name and build this project, you can see in your bin folder projectname.msi file is here generated...
  3. Lets add our code. first of all declare your product path and product code after this line                                                                    <?xml version="1.0" encoding="UTF-8"?> like  
     <?define PRODUCTPATH="$(var.Setupproject.TargetPath)"?> 
     <?define ProductVersion = "14.0.0.0"?>  
    <?define UpgradeCode = "{ Guid of UpgradeCode}"?> 
  4. And add in directory section a component and give its referance in feature section because it cant run without referance.                   <Directory Id="INSTALLFOLDER" Name="SetupProject1" >
              <Component Id="Setupfile" Guid="E2356FDB-A186-49FC-8FDE-0A3E618BB193" KeyPath="no">
                <File Id="SetupfileEXE" Name="Setupfile.exe" Source="$(var.PRODUCTPATH)" KeyPath="yes">  </File>                              OR                                                                                                                                                                                                                 <File Id="SetupfileEXE" Name="Setupfile.exe" Source="..\Mtproject\bin\Debug\Myproject.exe" KeyPath="yes">  </File>
              </Component>                                                                                                                                                      </Directory>  
  5. Remember that this path is your project .exe file path which having in your bin folder, not a wix project .ece file path
  6. Referance like this                                                                                                                                                                          <Feature Id="ProductFeature" Title="SetupProject1" Level="1">
          <ComponentRef Id="Setupfile"/>                                                                                                                                     </Feature>          
  7. Build Project your installer is ready but it is simple installer without UI...............
further talk about its UI in next blog

No comments:

Post a Comment