Parameterise Service start option in WiX installer
- by Jamiec
I have a ServiceInstall component in a WiX installer where I have a requirement to either start auto or demand depending on parameters passed into the MSI.
So the Xml element in question is
<ServiceInstall Vital="yes"
Name="My Windows Service"
Type="ownProcess"
Account="[SERVICEUSERDOMAIN]\[SERVICEUSERNAME]"
DisplayName="My Service"
Password="[SERVICEUSERPASSWORD]"
Start="demand"
Interactive="no"
Description="Something interesting here"
Id="Service"
ErrorControl="ignore"></ServiceInstall>
WiX will not allow using a PArameter for the Start attribute, so Im stuck with completely suplicating the component with a condition, eg/
<Component Id="ServiceDemand"
Guid="{E204A71D-B0EB-4af0-96DB-9823605050C7}" >
<Condition>SERVICESTART="demand"</Condition>
...
and completely duplicating the whole component, with a different setting for Start and a different Condition.
Anyone know of a more elegant solution? One where I don;t have to maintain 2 COmponents whjich do exactly the same thing except the Attribute for Start?