My current task is to create an installer. The dilemma: Visual Studio doesn’t provide a very robust Setup and Deployment project.
Create a WiX Project
Write a bootstrapper/custom GUI/etc. and P/Invoke msi.dll
Here’s what I’ve run into. WiX is pretty straight-forward and configurable. It is also open source, so you are able to rewrite the user-interfaces to fit your needs. The only thing is that the whole project is in XML, which means creating a dialog means setting values for buttons, labels, and textboxes manually. I’ve thought about writing a short program to create the dialogs for me, which I may still do. The problem I’ve found with WiX: I can’t figure out how to refer to code (Assembly Info). I have found two possibilities: replace WiX version via PowerShell script and using MSBuild tasks. However, my development team wants to make the project as simple as possible. Using WiX already means that everyone will have to install WiX in order to build the file properly. This will only be a problem until the next version of Visual Studio, which is supposed to ship with WiX installed.
Option 2 is one that I got from Rick Brewster, of Paint.NET fame. Well, not directly from him. Scott Hanselman has an excellent podcast which details the Paint.NET installer. It is beautiful in it’s simplicity. I’ll leave a few things out, to tailor it to my discussion.
I’ll start from the outside-in.
- The installer comes as an executable created by NSIS (#5 above). This installer basically acts as a zip file, which extracts the contents to the user’s application folder and runs the bootstrapper.
- The bootstrapper checks for the proper version of Windows, and .NET
- If the requirements .NET aren’t met, the .NET redistributable installer can be run from the directory.
- When everything is good, a custom GUI setup program runs.
- The program gathers necessary information, injecting it into the MSI installer which is actually the same one created by Visual Studio.
- Then, any number of MSI installers can be run.
This method of staging, bootstrapping, gathering, and then running seems the most efficient. The problem is that the whole MSI interoperability means having a full understanding of Windows Installer technology. It is possible, however, to simplify this even further. On the progress form, use msiexec and switches. Because I’m not that interested in fully understanding the Windows Installer technology at the moment, this option is a little more than I want to get into. But, I have actually started a project that uses a very similar method.
InstallShield and Wise cost money, so they are not options for me.
NSIS is another excellent option. The only problem I see with it is that it’s like learning another scripting language. Although it is very simple, it doesn’t particularly appeal to me. XML, however, does.
So, it looks like I’m going to go with WiX as my choice to create an installer.