WiX project to wrap an EXE installer inside an MSI (for Group Policy)

Group Policy is a convenient way to roll out an install across muliple machines in an office.

When the user reboots their machine, Windows checks for any appropriate installers coming down from Group Policy, and installs them, before user can login again.

For Group Policy installs, it is necessary to use an MSI installer.

Unfortunately, some products only have an EXE installer.
One example is Microsoft ReportViewer 2010 redistributable.

Below is a WiX project to install ReportViewer 2010, by first installing an empty product, which at the end of the install, runs the Report Viewer 2010 installer.

This WiX project could be used to install any other EXE installer (as long as it has a silent install mode).

This allows us to install ReportViewer 2010 using Group Policy.

This is a wxs file that was created within Visual Studio 2010, using the WiX wizard.

WiX version: Windows Installer XML v3.5

1:  <?xml version="1.0" encoding="UTF-8"?> 
2:  <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
3:      <Product Id="a115e1a3-f9d5-4dad-94a2-a2f8ca70a280" Name="oRV2010Installer" Language="1033" Version="1.0.0.0" Manufacturer="Odin Consultants Ltd" UpgradeCode="e5a54d76-441e-4636-886b-de9529d7b48d"> 
4:          <Package InstallerVersion="200" Compressed="yes" /> 
5:          <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> 
6:          <Directory Id="TARGETDIR" Name="SourceDir"> 
7:              <Directory Id="ProgramFilesFolder"> 
8:                  <Directory Id="INSTALLLOCATION" Name="oRV2010Installer"> 
9:                      <Component Id="ProductComponent" Guid="70df2f25-9e82-4f76-856d-ce3f8aeae5df"> 
10:                          <!-- TODO: Insert files, registry keys, and other resources here. --> 
11:        <!-- note: ReportViewer.exe is the INSTALLER for Reportviewer 2010 SP1. 
12:         Removing oRV2010Installer will remove ReportViewer.exe but will NOT remove Reportviewer 2010 SP1.  
13:         This is the desired behaviour, to allow for upgrades of oRV2010Installer. 
14:        --> 
15:         <File Id="ReportViewer.exe" Name="ReportViewer.exe" Source="bin\ReportViewer2010sp1\ReportViewer.exe" DiskId="1" KeyPath="yes" /> 
16:        <!--run a program at Windows start up:--> 
17:        <!-- 
18:        <Registry Id="OdinRV2010.rst" Root="HKMU" Action="write" 
19:           Key="Software\Microsoft\Windows\CurrentVersion\Run" 
20:           Name="Odin Report Viewer 2010" 
21:           Value="[INSTALLDIR]ReportViewer.exe" 
22:           Type="string" /> 
23:        --> 
24:       </Component> 
25:                  </Directory> 
26:              </Directory> 
27:          </Directory> 
28:    <!-- note: for testing, use /passive in place of /q --> 
29:    <CustomAction Id="RunReportViewer" FileKey="ReportViewer.exe" ExeCommand="/q" Impersonate="no" Execute="deferred" Return="asyncNoWait" />   
30:    <!-- note: only one msiexec can run at a time! (otherwise ReportViewer.exe gets stuck waiting for this msi to exit!) --> 
31:    <!-- we use 'asyncNoWait' to allows this MSI to exist, which lets ReportViewer.exe complete--> 
32:    <InstallExecuteSequence> 
33:     <!-- OnExit="success" - cannot use this --> 
34:     <Custom Action="RunReportViewer" Before="InstallFinalize"> 
35:      NOT Installed 
36:     </Custom> 
37:     <!-- ScheduleReboot is AFTER the install. Note: this will prompt the user :-( --> 
38:     <!-- 
39:     <ScheduleReboot After="InstallFinalize"></ScheduleReboot> 
40:     --> 
41:    </InstallExecuteSequence> 
42:    <Feature Id="ProductFeature" Title="oRV2010Installer" Level="1"> 
43:              <ComponentRef Id="ProductComponent" /> 
44:              <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. --> 
45:              <ComponentGroupRef Id="Product.Generated" /> 
46:          </Feature> 
47:      </Product> 
48:  </Wix>  



ref: WiX - http://wix.sourceforge.net/
ref: Group Policy - http://technet.microsoft.com/en-us/windowsserver/bb310732

Comments