Wednesday, March 2, 2011

Beginner’s guide to Windows Installer XML (WiX) 3.5

Summary: Slides and demo projects.
This is post #5 of the six-part Learning WiX series. For other topics, see:

Table of contents
  1. Background (why WiX?)
  2. Introduction (answers to common questions)
  3. Getting started (references and tutorials)
  4. How-to's and missing links
  5. Slides and demo projects
  6. Improved demo projects (32- and 64-bit installers)
I just updated and uploaded the slides from the presentation I gave to my work group yesterday (you can download the PowerPoint [PPTX] presentation from the SlideShare site):

You can also download the demo projects.

There are three demo solutions, each containing four projects, all implemented in Visual Studio 2010 (you also need WiX 3.5 Toolset/Votive):
  • A client (Windows Forms) application.
  • A server (Windows service) application.
  • A class library (DLL used by both client and server).
  • A WiX 3.5 setup project handling deployment of the client, server, and class library.
The demo apps (client, server, library) don't do much (they are there only for the WiX project). The WiX setup project illustrates how to accomplish the following:
  • Install and configure a Windows service.
  • Install a client application.
  • Install a class library in Global Assembly Cache (GAC).
  • Install a text (readme.txt) file.
  • Create shortcuts under the Start menu for the client app and text file.
  • Create a shortcut under the Start menu for the application uninstaller.
  • Display the advanced setup dialog sequence (wizards) allowing the user to select the installation scope (per user or per machine), specify product destination folder, chose which features to install (client, server, or both).
  • Perform major upgrades (upgrades will retain Windows service definition for the already installed server component).
  • Include application files in the setup package via project references (instead of hard coding the file names).
The three solutions illustrate a typical life cycle of a project. First, you build and deploy version 1.0. Then you can build and deploy version 1.5. The version 1.5 installer will upgrade the already installed version (you don't need to uninstall version 1.0 before installing version 1.5). Then you can do the same for version 2.0. Notice that installers preserve Windows service configuration during upgrades (if you redefine the service to run as a specific user instead of a local system account, the service configuration will remain intact).

UPDATE: See new and improved samples, which explain how to implement installers for 32- and 64-bit targets and do other things.
I'd also like to recommend two books which I found extremely helpful: WiX: A Developer's Guide to Windows Installer XML by Nick Ramirez covers WiX; The Definitive Guide to Windows Installer (Expert's Voice in Net) by Phil Wilson - general Windows Installer (MSI) concept:


And one more thank you to Jeffrey Sharp for his excellent WiX presentation (you can get the slides and watch Jeff's talk online).

See also:
My three-part introduction to WiX series

3 comments:

  1. nice.Thank you.
    Wix 3.5 documentation is problem :(

    ReplyDelete
  2. I like the post but I can't get it work because I can't get rid of existing project configurations...

    this build configuration part of Visual Studio is after many years still crap...

    maybe you can help me to solve it?

    ReplyDelete
  3. Are you saying that the sample doesn't work/ or something else?

    ReplyDelete