These days most of us are avoiding deployment hassles by writing web apps and/or mobile apps. However, there are still those wacky edge cases where you need to distribute a good old-fashioned Windows application. I currently have requirements for a project that may not always have internet access ~GASP~ and thus needs to store data locally, throwing a wrench into my make-everything-a-website manifesto.
In the past, I’ve used ClickOnce installations with great success. ClickOnce is a dream for distributing auto-updating client-server apps. However, ClickOnce doesn’t quite cut it for the project I’m working on. The reason I can’t use it is I need to write to the file system to import and export data and am toying with the idea of running a Windows Service in the background. MSDN has a good article on choosing between ClickOnce and Windows installer. Another issue I have is that ClickOnce installs to some random folder in ‘C:\Users\username\AppData\Local\Apps\’ which seems kinda bush league to me. Real programs live in ‘C:\Program Files’.
Having resigned myself to not using ClickOnce, my first step was to simply use the installer project type in Visual Studio. For reasons unknown, this feature was removed in 2012. I’m going to guess Microsoft is trying to push developers in the direction of making Windows 8 apps. Since more users have XP than Windows 8, that’s not not going to be a viable solution until around 2025.
Visual Studio recommends you get install shield LE, which is free after filling out a registration form. However, there is a problem; the registration form has been broken for the last two days.
This gave me the opportunity to dig a little deeper and look into all possible installer options. I narrowed it down to four options based on some google-fu.
|Install Shield||Inno Setup||NSIS||WiX|
(Or WiX Edit)
|Scripting||InstallScript||PASCAL||NSIS Script File||WiX XML|
Full disclosure – I didn’t do much research on Install Shield after being put off by the price tag and broken web registration. The research I did do was looking at each installer’s website and reading a few stack exchange questions. The remaining three versions are free and, from what research I did, all seem effective.
What I did gather is the general consensus is that WiX has the highest learning curve but is the most powerful. This is completely subjective of course and mostly based on second-hand accounts. If you’re reading this along with your morning coffee and need to get an installer shipped by lunch, I’d avoid using it.
The final thing to consider is creating a .exe verus a .MSI. If your application is going to be used by large companies who use group policies, an MSI is going to be a lot more friendly than a straight executable installer. MSI advantages include transparency, standardization, security, rollback, and patching. If you’re just doing a consumer product, either a .exe or a .msi will do the job.
I ended up choosing WiX for one reason: I often work with corporate clients. So far, we’ve done all ClickOnce installs. However, if we do need to do anything more advanced, I’d like to have the ability to create an MSI installer. If I’m over-emphasizing the need for MSI installers, please call me out on it. Barring that, all of the installers are overkill for what I currently need. Microsoft should have left the installer project in Visual Studio and made this developers life easier.
At the point of this writing, it took me around an hour to get a simple installer that copies my executable, dlls, and creates a shortcut. The application can also be uninstalled from Add/Remove Programs. I haven’t touched installing .NET framework or the upgrade process yet; that may warrant a separate post when I get there.
For further reading, check out each product’s website for more information and tutorials.