Book Image

WiX: A Developer's Guide to Windows Installer XML

Book Image

WiX: A Developer's Guide to Windows Installer XML

Overview of this book

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.
Table of Contents (18 chapters)
WiX: A Developer's Guide to Windows Installer XML
Credits
About the Author
About the Reviewer
Preface
4
Improving Control with Launch Conditions and Installed States
7
Using UI Controls

Adding a User Interface


Although you'll eventually want to add your own dialogs to gather information from the user that's important for your own application, you may want to use one of WiX's built-in dialog sequences in the meantime. All of them are stored in an assembly called WixUIExtension.dll. You can add a reference to this file with Visual Studio's Add a Reference screen. The file exists in WiX's Program Files folder. You may have to navigate to C:\Program Files\Windows Installer XML v3\bin.

Once you've added the new reference, add the following line to your WiX source file. It doesn't matter exactly where, as long as it's a child to the Product element:

<UIRef Id="WixUI_Minimal" />

This will insert the Minimal dialog set into your installation sequence. It shows a single dialog screen containing a license agreement and Install button. Feel free to try any of the other dialog sets. Just replace WixUI_Minimal, with one of the other names in the UIRef element. WixUI_Advanced and WixUI_InstallDir require some further setup to really work properly. You can try out the following attributes:

  • WixUI_Advanced

  • WixUI_FeatureTree

  • WixUI_InstallDir

  • WixUI_Mondo

We will explore these standard dialogs in more detail later and also explain how to create your own.