Friday, October 8, 2010

Introduction to WiX

Summary: Answers to most likely questions from Windows Installer XML (WiX) novices.
This is post #2 of the six-part Learning WiX series. For other topics, see:

Table of contents
  1. Background (why WiX?)
  2. Introduction (answers to common questions)
  3. Getting started (references and tutorials)
  4. How-to's and missing links
  5. Slides and demo projects
  6. Improved demo projects (32- and 64-bit installers)
Here is a list of questions I had a couple of weeks ago before I started working with WiX (Windows Installer XML). I hope that answers to these questions will help other WiX novices.

What is WiX?
WiX is a language (Windows Installer XML [eXtensible Markup Language]), or more specifically, a Windows Installer-specific XML syntax. You can use WiX syntax to author XML source files for your setup project, from which you can then build Windows Installer (MSI) packages with the help of WiX Toolset.

What is WiX Toolset?
WiX is distributed as a free (open-source) toolkit that includes several command-line tools (such as WiX compiler, linker, etc), documentation, and utilities. Once you create WiX source files defining your setup application (you can do it by hand in a text editor, such as Notepad), you can use WiX Toolset to compile these files into a Windows Installer (MSI) package.

Can I develop WiX projects in Visual Studio?
Yes, WiX Toolset's Visual Studio package, Votive, which is also free (and open-source), adds WiX-specific project templates to Visual Studio, so you can create and build WiX projects directly from Visual Studio. Votive also provides syntax highlighting and IntelliSense for WiX source files.

Which version of Votive do I need?
There are several versions of Votive (and WiX Toolset), each targeting specific versions of Visual Studio. At the time of writing, the latest version (v3.5 for Visual Studio 2010) was still in beta. The recommended version (v3.0) works with both Visual Studio 2008 and 2005. Earlier version(s) of the toolset target the earlier version(s) of Visual Studio.

How does Votive/WiX differ from Visual Studio Installer?
Visual Studio Installer (or Setup and Deployment Project Template) allowed you to build setup packages via drag-and-drop activities and automation. It automatically detected dependencies for your application files, generated GUIDs for components and features, and did a few other things in the background, so you may have not even realized that they were happening. When working with WiX projects you must perform all these tasks by hand.

So WiX is not as good as Visual Studio Installer, right?
Yes, and no. It's true that WiX requires more manual work. And it has a steep learning curve. But it's more flexible than Visual Studio Installer, it supports more features and customization, and gives you more control over the resulting setup package. And it produces a much cleaner MSI database.

Does WiX support all features of Windows Installer?
No, unfortunately not. WiX supports many common features of Windows Installer technology, but not all. The list of supported features includes (but is not limited to):
  • 32-bit, 64-bit, and mixed (32/64-bit) installers
  • Creation of shortcuts and registry entries
  • COM server registration
  • Windows service registration
  • Customization of setup dialog sequence (up to certain extent)
  • Creation of web sites
  • And much more
If you wonder about WiX support of a particular feature, check the web for articles and posts on the topic of your interest and you're most likely to find whether WiX support it or not.

Can I use WiX to create a bootstrapper program (setup.exe)?
No, WiX Toolset only allows you to build MSI and MSM (merge module) files.

What are other limitations of WiX?
See the answers posted on StackOverflow.

What are the differences between WiX project types?
In addition to regular installer projects, Votive allows you to build merge modules and WiX libraries. Merge modules let you share installable components among different products. For example, if you want to deploy a common COM component/ActiveX control with different applications, you can encapsulates its installer in a merge module and than use this merge module with regular WiX installer projects (the merge module will be absorbed in each product's MSI package). WiX libraries allow you to share identical sections of XML code between the WiX source files (this is similar to using include files in C/C++ projects).

What do I need to know before learning WiX?
In theory, you should understand Windows Installer (MSI) before you start learning WiX, but in practice you can learn both technologies concurrently. The abundant information available online can help you get started and achieve progress even if you have very limited understanding of Windows Installer.

Where do I find support if I get stuck?
You can start at StackOverflow (I found answer to most of my questions there). The "official" support site is at SourceForge.

I want to try WiX. Where do I start?
This will be the topic of my next post.

See also:
What about that WiX?
Dude, where is your installer?

4 comments:

teuf008 said...

Hi.
I have some questions to complete this introduction.
Do you any ideas of how 'popular' WIX is?
I mean: is it a solution used for many products? Also, for recent products?
It seems it was used by Microsoft itself for SQL Server 2005, Visio 2007, Visual Studio 2008... but I have no ideas for their recent products, did they continue using WIX?
Regards,
Christophe

Alek Davis said...

Hmm, good question. I don't work for Microsoft, so I have no insider knowledge. I've heard that Microsoft uses WiX internally for a range of products, Including MS Office, but I can't verify it. Did not find anything on Google.

teuf008 said...

Thanks for your answer anyway ;-)

Alek Davis said...

Based on Jeff Sharp's presentation, Microsoft built WiX-based installers for Office 2007, SQL Server 2008, SQL Server Modeling, and other products (see http://www.jeffreysharp.org/2010/10/13/setup-with-windows-installer-and-wix/).