Skip to content

Auto-update with WiX


Update: for a ready solution (library), see official release announcement 🙂

Windows Installer on itself is a pain. WiX saves you from it, mostly wrapping the complexity into XML constructs understandable to non-gurus.

Well, not completely – you still have to know:

  • why the heck shortcut didn’t appear in start menu;
  • how to create a web site shortcut;
  • why to create RegistryValue for a program directory you create, and that’s the simplest things. Still better then MFC…

But a very good tutorial exists, maillist is very active and it’s easy to get support.
Maybe it’s another reason to love Unix-es, where “install IS just a copy”.
Though, one has to admit that installing Windows application involves somewhat more desktop integration
.

I was looking for an auto-update, so that:

  • application could say “New version available, download? Restart now?“;
  • would use MSI;
  • download should preferably use BITS.

Simple automatic updaters like this on Codeproject won’t do, because you can’t just download necessary files: Windows Installer will revert them back. Or you would have to “disable WI’s Resiliency“, which is also a bad idea.

Solution of my choice

ClickThrough subproject of WiX promises that, but it’s still beta and crashes. Still you can easily compare two MSI files, generate a MSP patch, and a RSS feed that client can check, download and even read by eye, so simple it is – a pretty tasty feature.

There is no .NET client code. For now, there is only a separate update.exe that will find, download and install new version. Still, you cannot ask user whether to download now or not, cannot tell what’s new, when to restart, etc.
But you can painlessly add a Start menu shortcut that will update your application.

Come later, I’m going to create a C# code that will check for updates, and probably publish it.

Other solutions

You can use Updater ApplicationBlock, or more exactly, latest version now lives at CodePlex. But Enterprise Library wasn’t updated for .NET 3.5, and I believe it’s abandoned.

You can use NSIS. Though, it’s not Windows Installer MSI packager, it creates own files and scripts.

For ClickOnce application, you can use Application.Deployment.

8 Comments

  1. Wladimir Mutel wrote:

    NSIS is a pain as well, from my experience. Like to write in assembler for a weird virtual machine ? Go ahead :>

    Posted on 14-Mar-08 at 10:13 | Permalink
  2. Ewart wrote:

    Would be interested to hear how your auto-update solution works out, was about to look at wix ClickThrough myself… there seems to be limited doc’s.

    cheers
    ewart

    Posted on 15-Mar-08 at 06:20 | Permalink
  3. Victor Sergienko wrote:

    Thanks Wladimir, I just saw that only thing it has that I need – is a download() function in API – and decided I’d stick to more conventional do-it-yourself kits, like WiX.

    Posted on 19-Mar-08 at 19:20 | Permalink
  4. Victor Sergienko wrote:

    Hi Ewart,
    ClickThrough is not only limited in docs (“source is the doc”), but the source is incomplete and hardly functional. For now it is GOING to support only SmartClient and Office addon deployment.

    The only nearly-working thing I found is Updater appblock. It’s well-designed and mostly functional, though I had to hack out all EntLib dependencies <grin>

    I’ll blog about it in more detail when we’re done with the release I’m trying to install.

    Posted on 19-Mar-08 at 19:39 | Permalink
  5. guest wrote:

    Other solution would be to use ClickOnce to deploy a package that consists of your own code to perform all service tasks related to upgrade along with MSP itself. This model is far from perfect, of course, starting from deploying and installing your own certificate, which expires one day, taking care of security and other crap…

    P.S. If you can’t create a Program Menu shortcut, make sure you set “Advertise” property correctly for your shortcut.

    Posted on 21-Mar-08 at 11:18 | Permalink
  6. Victor Sergienko wrote:

    Thank you.

    I already came with own solution based on Updater 2 Application Block, will blog what I’m allowed to later.

    I knew that thing about Advertise, it’s another example of complexity that wrapper should hide.

    Posted on 21-Mar-08 at 11:21 | Permalink
  7. fayssal wrote:

    Hi Vector,

    Did you manage to have any running instance sample for using ClickThrough for auto-updates? It would be great if you could some sample code if you have it.

    Thanks.

    Posted on 26-Aug-09 at 13:00 | Permalink
  8. fayssal,
    I never managed to get ClickThrough autoupdate – it was too immature. I just took a FeedBuilder class out of its source and crossed it over with Updater Application Block.

    I’ll check if I can publish the component source. That should be useful for many.

    edit: Probably I’ll be able to publish a ready component on CodePlex. Will update in some days.

    edit2: You got it: http://victorsergienko.com/self-update-library-for-net-using-wix-dotupdater/

    Posted on 27-Aug-09 at 14:50 | Permalink

Post a Comment

Your email is never published nor shared.