I have been working on a new version of TFSIntegrator that will be released very shortly.   As part of the new release I wanted to include a new improved version of the setup project.   One of the goals that I wanted to include was the ability to install the service during the installation process.  With Wix V3.0 this is pretty easy.  There is a ServiceInstall and ServiceControl elements that you can use.   There are a couple of things to remember:

  1. The ServiceInstall element needs to be in the same component that install the file for the service. 
  2. The file that is used, is the one with the KeyPath attribute set to yes.

An example component is as follows:

<Component Id="InstallService" Guid="{A217EE94-F719-47c4-BEE0-28FDF944CD5C}">
     <File Id="EXECUTABLE1" Name="TfsIntegrator.exe" Source="Files\TfsIntegrator.exe" 
KeyPath="yes"/> <ServiceInstall Id="ABC" Name="TfsIntegrator" DisplayName="TfsIntegrator" Type="ownProcess" Start="auto" ErrorControl="normal" Description="TfsIntegrator" Account="[SERVICEACCOUNT]" Password="[SERVICEPASSWORD]" /> <ServiceControl Id="StartTfsIntegrator" Name="TfsIntegrator" Start="install" Wait="no" /> <ServiceControl Id="StopTfsIntegrator" Name="TfsIntegrator" Stop="both" Wait="yes" Remove="uninstall" /> </Component>