I’ve been doing a bit of work with installers recently – its not something that I have done a lot of and its been somewhat of a learning experience. The project initially started using the visual studio set-up projects but we quickly found that they didn’t fit our needs, so we turned to WIX (Windows XML Installers).
Right off the bat I’m going to say that I’ve found the whole WIX project to be messy – its sometimes hard to work out the right way to do things, the declarative xml syntax is confusing at times and some method/tag names are named confusingly. Another thing I have found that left me seriously stumped was that upgrading WIX itself via the installer sometimes doesn’t update everything – so one piece of advice when upgrading…shut down everything and uninstall it first!
That said, when you get it all running it works very well and is pretty flexible.
Upgrading on Revision Number
Anybody that knows me will probably know I’m a huge fan of continuous integration, deployment and delivery. I love to leverage a build server to take care of as much as possible, and am a strong subscriber to the ethos of always being able to push out changes. In this scenario I have a build server running that changes the revision number off all built assemblies on every build to the changeset number of that build. I really like this method of automatic versioning – its simple, effective and (at least in TFS) allows you to reproduce a build from a given point in time.
As part of the build we’re also building our WIX installer. The version number is important to WIX as it plays a part in determining whether something can be upgraded. In this example we wanted our WIX installer to always upgrade if the version number was higher – but in particular the revision portion of the version number.
Just as a reminder, version numbers are structured as Major.Minor.Build.Revision (yes I know we should probably be setting the 3rd portion but we’re not!!).
Getting WIX to upgrade based on this number requires the use of the WIX MajorUpgrade tag – not the most descriptive tag name! Although it can be a little difficult to find this, implementing it is a piece of cake. You just need to add a tag like the following within your Product element:
So whilst it can be difficult to find the answer with wix, in the end its a simple solution!