This post outlines some of the things I have found out since working with the new Burn code, unless otherwise stated this refers to version 3.6.2830.0 or later. For my requirements I have only needed to create single file installation setups, so none of these examples will include download code. I keep the source to resources in a folder called “Resource” so in the examples below "Resource\" is a reference to this folder.
In many cases this information has been gleaned from the WiX Users mail list. If you spot any errors or can suggest improvements please let me know.
Basic Template
This is my outline framework that I have been using to create a burn project:
<?xml version="1.0" encoding="utf-8"?>
<?ifndef Version?>
<?define Version = "1.0.0.0" ?>
<?endif ?>
<Wix RequiredVersion="3.6.2830.0" xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="My Application" Version="$(var.Version)" Manufacturer="ACME" UpgradeCode="PUT-GUID-HERE"
HelpUrl="http://www.nowhere.com"
Copyright="Copyright© 2012, ACME" IconSourceFile="Resource\Setup.ico"
SplashScreenSourceFile="Resource\SplashScreen.bmp"
AboutUrl="http://www.nowhere.com"
Condition="((VersionNT >= v5.1) AND (ServicePackLevel >= 3)) OR ((VersionNT >= v5.2) AND (ServicePackLevel >= 2)) OR (VersionNT >= v6.0)">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense" />
<WixVariable Id="WixStdbaLicenseUrl" Value="" />
<WixVariable Id="WixStdbaLogo" Value="Resource\logoSmall.png" />
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]ACME\My App" />
<Chain>
<PackageGroupRef Id="Netfx4Full" />
<RollbackBoundary />
<MsiPackage
Id="Setup"
Compressed="yes"
SourceFile="$(var.Setup.TargetPath)"
Vital="yes">
<MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>
Notes:
- This template reference the .Net 4 framework, for this I just copied the WiX source but set ExePackage/@Compresses=”yes” to embed the framework in my installation.
- The Bundle/@Condition sets the install to only run on Windows XP SP3, Windows 2003 SP2 or later.
- The WixStdbaLicenseUrl is set to an empty string to hide the license URL hyperlink as it is not require for my installation.
- By referencing my WiX MSI setup project in the burn project I can reference the MSI using the syntax SourceFile="$(var.Setup.TargetPath)" where Setup is the name of my project.
- The preprocessor variable for the version allows me to set the version from my build environment.
No License UI
To create an installation without a license URL link use the following:
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense" />
<WixVariable Id="WixStdbaLicenseUrl" Value="" />
Hyperlink to local License file
If you want to have a link to local license file as part of your installation save the license file as an html document and then reference it as follows:
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<Payload SourceFile="Resource\License.htm" />
</BootstrapperApplicationRef>
<WixVariable Id="WixStdbaLicenseUrl" Value="License.htm" />
This embeds the file license.htm file within the bundle and extracts it when the installation is run, if the user clicks the hyperlink then the file is loaded in the default browser.
RichText box license dialog
To create an installation with the license displayed in a richtext control use the following:
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<WixVariable Id="WixStdbaLicenseRtf" Value="Resource\License.rtf" />
Custom UI
If you want to customise the standard UIs copy them from the WiX source and reference them like this:
<WixVariable Id="WixStdbaThemeXml" Value="Resource\HyperlinkTheme.xml" />
<WixVariable Id="WixStdbaThemeWxl" Value="Resource\HyperlinkTheme.wxl" />
.Net Framework 3.5 SP1 Install
To install the .Net Framework v3.5 SP1 I use this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v3.5" Value="Version" Variable="Netfx35Version" />
<PackageGroup Id="Netfx35">
<ExePackage Id="Netfx35"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Name="Redist\dotnetfx35.exe"
SourceFile="..\Redist\dotnetfx35.exe"
InstallCommand="/q /norestart /lang:ENU"
RepairCommand="/q /norestart /lang:ENU"
UninstallCommand="/q /norestart /lang:ENU"
InstallCondition="NOT Netfx35Version OR (Netfx35Version < v3.5.30729.1)"
DetectCondition="Netfx35Version AND (Netfx35Version >= v3.5.30729.1)">
<ExitCode Value ="3010" Behavior="forceReboot" />
</ExePackage>
</PackageGroup>
</Fragment>
</Wix>
Signing a package
This is the approach I use (http://wix.sourceforge.net/manual-wix3/insignia.htm):
- insignia -ib Setup.exe -o engine.exe
- signtool engine.exe (extra parameters excluded for simplicity)
- insignia -ab engine.exe Setup.exe -o Setup.exe
- signtool Setup.exe
You can also use modify the wixproj to override the SignBundleEngine and SignBundle targets (sample copied from this thread http://sourceforge.net/mailarchive/message.php?msg_id=29179087):
<Target Name="SignBundleEngine">
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\signtool.exe" sign /f privatekey.pfx /p mypassword /t http://timestamp.comodoca.com/authenticode "@(SignBundleEngine)"" />
</Target>
<Target Name="SignBundle" >
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\signtool.exe" sign /f privatekey.pfx /p mypassword /t http://timestamp.comodoca.com/authenticode "@(SignBundle)"" />
</Target>
I found this problematic because:
- My certificate is not in the certificate store so I have to use signtool (as above).
- Signtool is not in the path or referenced via an environment variable so you have to know the path to the location of the Platform SDK you have installed and hard code it.
- You signing password is hard coded in the wixproj file.
Edit 07/05/2012: ARPSYSTEMCOMPONENT not required as this supplied by burn.