views:

883

answers:

2

Hi,

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

A: 

You can definitely install and start services with WiX - I'm doing that all day, every day :-)

Check out the [ServiceInstall][1] and [ServiceControl][2] elements (there are even more, if you need to specify even more).

Basically, you need to first define your service file (YourService.exe) as a file in a component, and then you need to specify the ServiceInstall (and possibly ServiecControl) elements in addition to that.

<Component Id='YourServiceComponent' Guid='.....' DiskId='1'>
  <File Id='YourServiceEXEFile' Name='YourService.exe' 
        src='(path to your EXE)/YourService.exe' KeyPath='yes'/>
  <ServiceInstall Id='YourServiceInstall' Name='YourServiceName' 
                  Description='.....' ErrorControl='normal' 
                  Start='auto' Type='ownProcess' Vital='yes' />
  <ServiceControl Id='UninstallYourService' Name='YourServiceName' 
                  Remove='uninstall' Wait='yes' />
</Component>

Then you need to add this component to one of the features in your install that's being installed - and that's about it!

Marc

marc_s
Hi Marc,Thanks for the response. I have the service install part down. The part that I'm stuck with is showing the user a screen where they can enter some configuration information that is then persisted to disk. I'd like this to be part of the install package.Apologies if my question was not clear.
tardomatic
A: 

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.

Jared
Hi, thanks for the response. I think I am going to need to find an alternate method to doing this, as what needs to happen can't easily be done via VBScript (encryption, talking to SQLite db, talking to WCF service). I think I am going to do a basic installer using Wix and have a Settings application that manages settings for my services launch on afterinstall.
tardomatic