Installers

I’m currently working on a somewhat oddball project at work. The output of this project is going to be a DLL that will need to get deployed on a bunch of production servers, along with some related support DLLs. These DLLs will need to get deployed to some combination of four different folders, depending on the configuration of the target machine.

The last time I had to do something like this, I put together an installer with WiX. That project got revised in such a way that I wound up not needing the installer anyway. But I remember it as being a bit of a pain to put together, and I’m not even sure if I managed to create an installer that did everything I needed it to.

I looked at WiX again for this, but for now I’m using NSIS, which I’ve used before, in the (distant) past. I actually assumed NSIS was dead (or close to it), but it appears that it’s not. Version 3.0 was just recently released, on July 24, 2016. I’ve actually gotten pretty far with NSIS. It took most of the day, but I now have an installer that does what I need it to do, without too much weirdness.

WiX and NSIS have some similarities, but it’s important to understand the differences. WiX generates MSI files, so those are “official” modern Windows installer files. NSIS generates EXE files that can act as standard installers, in the sense that they can add your program to the Windows “Programs” list, and can implement an uninstaller, but they’re not MSI files. (This can be good and bad; in my case, it’s helpful, as I don’t really want a standard Windows installer or uninstaller.)

There’s another limitation with NSIS: it only produces Windows apps, not console apps. It has support for “silent” installs, so you can run it from the command line with no user interaction. But you can’t (easily) read stdin or write to stdout. I can live with that, but if I knew that when I started, I might have made a different choice.

NSIS is one of those tools that’s been around for a long time and has had a bunch of stuff grafted onto it over the years, so it’s got a lot of peculiarities in its syntax and style, but if you can get past all that, it’s a really useful and powerful tool. (It’s kind of like AutoHotKey in that respect.) There’s an interesting line in the NSIS docs that sums this up well: “The instructions that NSIS uses for scripting are sort of a cross between PHP and assembly.” It’s a weird hybrid of low-level and high-level stuff, and it takes some getting used to.

I’ve also written a couple of PowerShell scripts for this project that act a bit like make files. I could probably use nmake for those, but PowerShell is fine. I briefly considered trying to use Cake and/or Fake for this project, but either one of those would have introduced added complexity for no useful purpose. (Though it would have been fun to play with those tools!)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.