29 Oktober 2009

WiX Lessons Learned

The last week I was playing around with the Windows Installer XML to create a simple setup for a very simple product implemented with .NET. All I needed to do was to copy some files, install a service under a custom account, let the user enter the address of some web services.
These features are hot:
  • open source
  • frontend for the built-in windows installer
  • done by people who know windows installer inside out
  • simple declaration of files and actions in xml
  • simple install/deinstall of services with properties like windows account or description
  • custom actions can done with .net very easily, they have read/write access to properties via a session object (see tutorial)
  • you can use managed custom actions for easy validation of custom dialogs
  • can easily integrated into automatic msbuild builds
  • very good logging capabilities which helps you on debugging
  • property based, declarative style
  • property values can be changed by administrators to support customized automatic install on clients
  • support for commit/rollback and repair/maintenance mode
But this is what bites me:
  • Bringing new Custom Dialogs (e.g. query user/password) into the dialog chain is really a pain in the ass. The chaining is done through adding event-actions to the next/back buttons which open new dialogs. Adding some conditional logic if a dialog should be shown or not has to be done by attaching conditions on the adding of event actions of the Next button of the previous dialog and the Back button of the following dialog. An you have to deal with this because on Repair/Maintenance Mode your need probably another dialog sequence.
  • Managed Custom Actions don’t seem to work in elevated mode. The bad thing is, that the installation succeeds without an error, and the custom action is ignored (that is unless you look into the log file).
  • There is no easy way to manipulate files, say app.config on the fly during installation. There is an XmlConfig extension you can use, but using it is rather crude, if you know how to do it in managed code.
  • The GUI support is very limited, you can have edit, password, combobox, listbox, check and radio controls, but layouting is done by entering x and y coordinates by hand. Browsing for a file is impossible, you can browse only for directories.
Other things:
  • You need the WiX tutorial or you are lost
  • You need DTF (Deployment Tools Foundation) for managed custom actions
    • it is included in the WiX package
    • the documentation is hidden in the doc folder of you installation … it is neither linked from the WiX documentation nor to be easily found on the internet

  • If you are a mortal .NET developer you have to do bend your mind to understand it, the windows installer technology sometimes feels like C64 basic with line numbers. Don’t be afraid, after one or two frustrating days you will get it.