tags:

views:

2025

answers:

3

I'm using WiX to create an installer for a windows service. It's desirable that the name of service that gets installed and displayed in Services is configurable at install time.

For example, this is what I'm thinking (wix xml snip):

<ServiceInstall 
    Id="MyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Type="ownProcess" 
    Start="auto" 
    ErrorControl="normal" 
    Description="My Service" 
    Account="localsystem"/> 

<ServiceControl
    Id="StartMyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Start="install"
    Wait="no" />

<ServiceControl
    Id="StopMyServiceInstaller" 
    Name="NAME_PASSED_FROM_DIALOG" 
    Remove="uninstall"
    Stop="both"
    Wait="yes" />

NAME_PASSED_FROM_DIALOG is something I would like to hook up to a custom dialog that gets created and gets displayed to the person installing the service so they can set/modify the service name. I think this is very similar to the WIXUI_INSTALLDIR property that gets set and passed to the WixUI_InstallDir Dialog Set.

My question is:

How do I create a custom UI dialog that can accept user input which gets passed into runtime of the installer?

+4  A: 

Have fun with UI! This tutorial should give you a good start into the UI aspect. A high level overview of what will be happening is:

  1. Create a property
  2. Have the UI control set this property
  3. The name attribute on the service will reference the property, ie [ServiceNameProperty].
Darren Kopp
Yes and I highly recommend copying an existing dialog that is somewhat like what you want and tweak from there. A lot easier than building from scratch, IMHO.
Rob Mensching
+1  A: 

This WIX WIKI helped me when creating my custom dialogs for WIX.

CheGueVerra
+1  A: 

The problem I have with using properties to set Service Name is that when you try to uninstall the service the service can not find the service name.

Alan Frye
Remember the Windows Installer does not persist properties. That means you need to create your own mechanism to remember the properties for uninstall. I like using a registry key and RegistrySearch to do that.
Rob Mensching