About
Wix (Windows Installer XML Toolset) is:
- a windows installer toolset (light.exe, candle.exe)
- where you specify declaratively in one or more XML your installation
- based on the installer api of windows
Jpackage used it to generate their installer on Windows.
The below section are juste note from the tutorial
Articles Related
Advantages / Disadvantage
Advantage:
- declarative
- Easily integrated in a Microsoft Visual Studio Build
Disadvantage:
- Needs all files to install and not only the directory (making the use of the heat utility mandatory
- No scripting
Syntax of the Wsx XML file
Node id
- for each element, an Id identifier should be specified and unique for the xml file (because they are reused, cross-referenced)
Version
For the Version attribute, use the standard major.minor.build format. Windows Installer will ignore an eventual fourth field, .revision as it provides other means to differentiate revisions.
Component
The component is the atomic unit of things to be installed.
It consists of resources—files, registry keys, shortcuts, or anything else—that should always be installed as a single unit.
A component should only contain items that belong together so strongly that they always need to be installed or removed together.
Generally, most single file will go into one component.
Each component needs:
- an Id identifier as GUID. These GUIDs are the only means for Windows Installer to keep track of the various components and should then be unique by component.
- a key path. This is the item Windows Installer can later check to see whether the component is actually installed.
Heat
Because there is no way to declaratively, adding a directory and its children, Wix comes with the heat tool (tuto)
To create a Fragment
heat dir path\to\your\directory -gg -cg SampleGroup -out SampleGroup.wxs
where:
- cg is the ComponentGroup name
- gg will generate the GUIDs
Add it into your main wsx file
<Feature Id='Complete' Level='1'>
<ComponentGroupRef Id='SampleGroup'/>
</Feature>
Directory Node
The directory node describe the hierarchical structure of the target folder structure created and links the target source to the source file.
Target Folder can be by set by name (one of predefined name) in place of a full path such as:
- ProgramFilesFolder,
- ProgramMenuFolder,
- and DesktopFolder
According to established guidelines, installed files go into predetermined locations. For instance, applications should go under \Program Files\Company\Product
Shortcut
Shortcuts can be non-advertised (a simple link pointing to the file in the shortcut's Properties dialog) or advertised (with the link greyed out). This second form lets Windows Installer repair the installation by replacing any missing file the shortcut points to.
Management
Installer generation
candle.exe SampleFirst.wxs.xml
light.exe SampleFirst.wixobj
Testing
Action that you can perform while testing the generated installer.
Log
When testing the installer, you can generate a log
msiexec /i installer.msi /l* installer.log
REM more verbose
msiexec /i installer.msi /l*v installer.log
Removing the application
uninstall
- manually: open the Programs and Features Control Panel tool
- code:
msiexec /x installer.msi
Tools
- WixEditor helps you create the xml wxs file