Saturday 29 September 2007

WiX

It's been a long time since my last post, and if I've any excuse it's being busy with several of my projects (among other things), about which I hope to make some blog posts soon, but for the moment I have a bit of promoting to do for WiX. If you haven't come across it before, it stands for Windows Installer XML and is a toolset for creating Windows Installer packages (probably best known to you in the context of MSI setups) from XML source. It's an official Microsoft product but it's hosted on SourceForge, so it's open source and has dedicated developer base. In the past I've experimented with Inno Setup before and I know many developers use this tool or other popular ones like Nullsoft to create their setup packages. Despite their advantages of being well supported and simple to use programs to create installers, I've found WiX has a lot to offer. Here's a few of the reasons I've switched over:
  • WiX takes a declarative approach to installing packages on a system, rather than the traditional imperative approach taken by most installer systems on Windows. This basically means that instead of telling the system what to do in a step-by-step fashion, it tells it what state the system should end up in after installation: this includes files, shortcuts, registry entries, and all the other possible tasks you might want your installer to perform. The sorts of problems like unused files and shortcuts remaining on the user's system become virtually non-existent when taking this approach. As soon as you start learning WiX, you'll also soon see why XML is the perfect language for this. Admittedly, it is a slight downside that you have to write your installer source by hand, but a huge advantage is its powerful integrated build support. (I'm just using Powershell scripts to build the installer, but as a friend suggested you could take it the whole way and integrate it with the MSBuild XML files if you're using Visual Studio). Even so, the XML format is surprisingly simple and there are detailed schemas to help write the code accurately. If you still prefer to develop installers by GUI (although I'd probably recommend against it as it may limit you in some ways and hide the true versatility of WiX), there's a few GUI interfaces currently being developed.
  • Developers of the installer can independently write their own WXS source files, and then compile and link them without any moving around of XML code.
  • Great support for localisation/custom languages, as far as I can see - though I must admit I've only read sections about it and not actually tested it out yet.
  • I was amazed to read that the entire installer for MS Office 2007 was created using WiX - there really shouldn't be any reason to doubt its power!
  • If you need more convincing, try reading the tutorial (it assumes you're a complete beginner, and probably explains some of the points here better than me) or even glancing at the manual.

This is just a brief outline of what WiX can do. I strongly recommend you head over to the site, download the toolset (v2.0 is probably best for now, considering it's the most stable and the tutorial is written specifically for it). You can find the tutorial here, but also as a link on the page along with the official documentation. I'm still a total beginner at WiX myself - reading the tutorial, experimenting with a few of its more simple features, and looking at some interesting blog posts about it - but I can already undoubtedly say it's a good move away from the typical unreliable setup.exe installers that have plagued Windows users in the past.