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

Viewing the MSI database


I mentioned before that an MSI file is really a sort of relational database. WiX does all the work of creating tables, inserting rows, and matching up keys in this database. However, as we progress through the rest of the book, I encourage you to explore how it looks behind the scenes. For example, we discussed the File and Component elements. Sure enough, there are two tables called File and Component in the MSI that contain the definitions you've set with your XML markup. To get inside the installer, you'll need a tool called Orca.

Orca.exe

Once you've compiled your project in Visual Studio, you'll have a working MSI package that can be installed by double-clicking it. If you'd like to see the database inside, install the MSI viewer, Orca.exe. Orca is provided as part of the Windows SDK and despite the icon of a whale on the shortcut, stands for One Really Cool App. You can find versions of the SDK at Microsoft's Windows Development Center website:

http://msdn.microsoft.com/en-us/windows/bb980924.aspx

After you've installed the SDK (specifically, the .NET tools that are included), you can find the installer for Orca—Orca.msi—in the Microsoft SDKs folder in Program Files. On my machine, it can be found in C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin.

Install Orca and then right-click on your MSI file and select Edit with Orca.

Orca lets you view the database structure of your installer. This can be a big help in troubleshooting problems or just to get a better idea about how different elements work together. Following is a screenshot of the Component database:

If you wanted to, you could edit your MSI package directly with Orca. This is helpful when learning or trying out different concepts. You'll need to know exactly which tables and rows to modify. Sometimes, though, you'll be able to just change a single value and check its effect.