I have the following declaration of my service:
<ServiceControl Id="ServiceStartStop"
Name="[name]"
Start="install"
Stop="both"
Remove="both"
Wait="no"/>
<ServiceInstall Id="ServiceRegister"
Name="[name]"
DisplayName="[displayname]"
Description="[description]"
Account="LocalSystem"
Arguments="-start"
ErrorControl="critical"
Interactive="yes"
Start="auto"
Type="ownProcess"
Vital="yes" >
<util:PermissionEx User="Authenticated Users"
ServiceChangeConfig = "yes"
ServiceEnumerateDependents = "yes"
ServiceInterrogate = "yes"
ServicePauseContinue = "yes"
ServiceQueryConfig = "yes"
ServiceQueryStatus = "yes"
ServiceStart = "yes"
ServiceStop = "yes"
ServiceUserDefinedControl = "yes" />
</ServiceInstall>
This compiles and links without any errors or warnings. The service exe
is properly specified using KeyPath="yes"
. When I run my msi, it can't get beyond at 'Starting Service...'. I get an error message, as follows:
The UAC is shown when I click 'Install', so what's going wrong?
It should work without the WiX util extension. Here is my complete test installer. Create your own test project and copy and past my installer into your .wxs file. Then replace the File, ServiceInstall and ServiceControl paths and names with your own service. If you still get the same error message, could it be that you don't actually have the privileges to do the install on your machine?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TestServiceInstaller" Language="1033" Version="1.0.0.0" Manufacturer="test" UpgradeCode="d2b63c57-ca50-4f6a-8019-e826cac3d788">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="TestServiceInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="TestServiceInstaller" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="TestService.exe" Guid="196BB5E5-F157-4CA2-B740-0A68E1539B7C">
<File Id="TestService.exe" Source="C:\Users\bryan.johnston\Documents\visual studio 2010\Projects\TestService\TestService\bin\Debug\TestService.exe" KeyPath="yes" />
<ServiceInstall Id="TestService.exe" Name="TestService.exe" Account="LocalSystem" Arguments="-start" Start="auto" Interactive="yes" Type="ownProcess" Vital="yes" ErrorControl="critical" />
<ServiceControl Id="TestService.exe" Name="TestService.exe" Stop="both" Start="install" Remove="uninstall" Wait="no" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>