C# – WiX installer and custom actions


I have an application that is a not so simple Windows service (C#). I created an installer using Visual Studio 2008, which did the job of installing the service on the clients machine, but using the Visual Studio deployment project has 2 drawbacks:

  1. I can't seem to get the installer to build using MSBuild (i've tried the DevEnv.exe method). The service is a small piece of a much larger project, and I'd like the build of the MSI file to happen at the same time as my build does. I have used WiX for the other installers, but this particular application requires a configuration step in the setup.
  2. There seems to be a bug in VS 2008's deployment project when installing windows services. On repair and upgrade, the service is never stopped. (caused by an invalid sequence for RemoveExistingProducts – i have worked around this by changing the sequence to 1525)

What is nice about VS2008's deployment project is that I created a custom action that shows a form that gets some info from the user, connects to a WCF service, which retrieves data and stores it in an encrypted data store on their local machine for use by the service.

Now, I have looked high and low, and I don't see this being possible with WiX. Running an EXE after the program has installed isn't 'nice'. I'd like to be able to call a method in my Custom Action DLL that displays the form, and does the processing it needs to. Is there any way of doing this with WiX? — or even, create a custom GUI in WiX that gets the values and passes these values to a method for processing

So, questions:

  1. Is this possible with WiX?
  2. What are my alternatives if not?

Many thanks

Best Solution

The answer to your question #1 is yes, but it's a little involved. You can define dialogs to collect info from the user with the UI element and store it session properties. You can insert these dialogs into the flow with the Publish element. You can then create a vb script CustomAction and do just about anything with those session properties. Check out this tutorial for more.