Free Sample
+ Collection

WiX: A Developer's Guide to Windows Installer XML

Nick Ramirez

If you’re a developer needing to create installers for Microsoft Windows, then this book is essential. It’s a step-by-step tutorial that teaches you all you need to know about WiX: the professional way to produce a Windows installer package.
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849513722
Paperback348 pages

About This Book

  • Package your software into a single-file, double-click MSI for easy installation
  • Read and write to the Windows Registry and create, start, and stop Windows Services during installation
  • Write .NET code that performs specific tasks during installation via custom actions
  • Learn how the WiX command-line tools work to build and link your project
  • Become proficient with to-the-point examples and real-world advice

Who This Book Is For

If you are a developer and want to create installers for software targeting the Windows platform, then this book is for you. You'll be using a lot of XML so that you get accustomed to the basics of writing well-formed documents, using XML namespaces and the dos and don'ts of structuring elements and attributes. You should know your way around Visual Studio, at least enough to compile projects, add project references, and tweak project properties. No prior knowledge of Windows Installer or WiX is assumed.

Table of Contents

Chapter 1: Getting Started
Introducing Windows Installer XML
Your first WiX project
Adding a User Interface
Viewing the MSI database
Turning logging on during installation
Other resources
Chapter 2: Creating Files and Directories
File element
DirectoryRef element
ComponentGroup element
Fragment element
Harvesting files with heat.exe
Copying and moving files
Installing special-case files
Creating an empty folder
Setting file permissions
Speeding up file installations
Chapter 3: Putting Properties and AppSearch to Work
Custom properties
Predefined Windows Installer properties
Chapter 4: Improving Control with Launch Conditions and Installed States
Action state
Installed state
Chapter 5: Understanding the Installation Sequence
Custom actions
Rollback custom actions
Accessing properties in a deferred action
Adding conditions to custom actions
Deployment Tools Foundation
Chapter 6: Adding a User Interface
WiX standard dialog sets
Creating your own dialogs
Modal windows
ICE20 revisited
Chapter 7: Using UI Controls
Chapter 8: Tapping into Control Events
Publish element
Subscribe element
Publish events
Subscribe events
Chapter 9: Working from the Command Line
Compile-time variables
Conditional statements and iterations
Link-time variables
Building an installer without Visual Studio
Chapter 10: Accessing the Windows Registry
Reading from the Registry
Writing to the Registry
Removing Registry values
Copying Registry values
Registry permissions
Chapter 11: Controlling Windows Services
Creating a simple Windows service
Using sc.exe
Starting, stopping, and uninstalling a service
Setting the service's user account
Adding service dependencies
Service recovery with Util:ServiceConfig
Chapter 12: Localizing Your Installer
Setting language and code page attributes
WiX localization files
The role of Light.exe
Localizing error messages
Localizing the EULA
Creating a multi-language MSI
Chapter 13: Upgrading and Patching
Planning for updates
Major upgrade
Minor upgrade
Small update

What You Will Learn

  • Install, start, stop, and uninstall Windows Services at the time of setup
  • Make your project more modular with Fragments, ComponentRefs, and ComponentGroups
  • Learn tips for installing special types of files such as font files and how to optimize copying speed
  • Prevent users from installing your software on unsupported operating systems and introduce other pre-requisite checks
  • Gain an understanding of the order in which events happen during an install and how to add your own actions to this sequence
  • Build a customized user interface that meets the unique requirements of your project
  • Understand how WiX builds and links your files into the final MSI package and how to control this process
  • Read and write to the Windows Registry with XML
  • Build various language-specific installers without duplicating large amounts of code
  • Create rules for checking for and removing older versions of your software or to patch existing files

In Detail

WiX is an open source project and a toolset that builds Windows installation packages from XML source code. WiX, which is used internally by Microsoft and by many companies around the World, simplifies many of the installation tasks that used to be shrouded in mystery. The tool set provides a command-line environment that you can integrate into your old-style build processes or you can use the newer technology from inside integrated development environments to build your setup packages. You'll find that you understand your installer better, can create it in less time, and save money in the process. No one really wants to devote a lifetime to understanding how to create a hassle-free installer for any software.

This hands-on guide takes the mystery out of Windows Installer by showing how simple XML elements can be leveraged to create a sophisticated install package. By relying on Microsoft standards, you'll be able to use features like Property elements to customize your application's entry in Add/Remove Programs, the Shortcut element to create Start menu shortcuts, and other specialized elements for building upgrade and patch support and more.

This book will show you the fundamental ingredients needed to build a professional-grade installer using Windows Installer XML. The initial chapters will introduce you to the set of required elements necessary to build a simple installer. We'll then explore those basic elements in more detail and see how best to use them in the real world.In the ensuing chapters, you'll move on to learn about adding conditions that alter what the user can install, then how to add actions to the install sequence and how to author a user interface. We'll move on to advanced topics such as editing data in the Windows Registry, installing a Windows service, and building your project from the command line. Finally, you'll learn to localize your package for different languages and detect older versions during upgrades. Each chapter uses to-the-point examples to illustrate the best way to use the language.


Read More