0
votes

I'm using the project reference feature of WiX to harvest a project automatically using Heat. This is particularly useful since the WiX installer is being built both locally and on a TFS2010 build server, and when it's built on the build server the output is redirected to a different location meaning that if I don't automatically harvest the projects, it gets very messy trying to reference the correct location for recently compiled items.

I have the following WiX "code" to install and start the service:

<ServiceInstall Id="MyService"
 Type="ownProcess"
 Vital="yes"
 Name="MyServiceName"
 DisplayName="My Service Display Name"
 Description="My Service Description"
 Start="auto"
 Account="[SERVICEACCOUNT]"
 Password="[SERVICEPASSWORD]"
 ErrorControl="ignore"
 Interactive="no" />
<ServiceControl Id="StartService" Name="MyServiceName" Start="install" Wait="no" />
<ServiceControl Id="StopService" Name="MyServiceName" Stop="both" Wait="yes" Remove="uninstall" />

So far, so good... I get a problem when the installer tries to install and start the Windows Services however saying "Service 'MyServiceName'(MyServiceName) failed to start. Verify that you have sufficient privileges to start system services". If I choose the "Ignore" button, the installation completes "successfully", but when I check the services installed on my machine, the new service isn't listed.

From my investigations online, I believe that the problem is that the service isn't actually getting installed correctly because I need to set the KeyPath to the executable that should be run as the service, but since I am harvesting the files using Heat, I can't find a way to do this... unless I create a custom action which will install the service for me allowing me to specify the executable name once all the files have been installed... but that doesn't sound like it should be the right solution...

Does anyone have any advice or have they encountered the same problem and come up with a solution?

Thanks

UPDATE 07/10/10: In my WiX script, I have the following:

<Directory Id="INSTALLLOCATION" Name="Dolphin Transfer Service Server" ComponentGuidGenerationSeed="AF89976D-CD66-4b94-911B-1D27F969BC14">
    <Component Id="ServiceComponent" Guid="F55415F7-803C-4a83-A677-C0F882699374">
        <ServiceInstall Id="DolphinTransferService" Type="ownProcess"...

and the target directory for my harvested files is the INSTALLLOCATION directory.

Looking at the msi using Orca, I can see my ServiceComponent and all the generated components for each harvested file. Looking in the File table, there are no files associated with this component (since they have a component generated for each file...). Looking in the ServiceInstall table, the component that it is trying to install is ServiceComponent.

So I think that I need to somehow get the ServiceInstall element to be inside the component that is generated for the service exe so that it installs this component as a service and not the empty "ServiceComponent" component? But since this component is generated at build time by heat I've not managed to make any further progress...

1

1 Answers

0
votes

The output of heat is a WXS authoring with one file per component. This is the default behavior and can't be changed using standard heat switches. This was done to natively follow the component rules.

If a component contains a single file, this file is automatically a KeyPath. Hence, if you don't transform the output of heat and keep to the rule "one component - one file", this must not be the reason of the error you get.

I would suggest investigating the verbose log and see if it contains more detailed description of the failure you face with.