Parameterise Service start option in WiX installer
Posted
by Jamiec
on Stack Overflow
See other posts from Stack Overflow
or by Jamiec
Published on 2010-03-23T13:31:21Z
Indexed on
2010/03/23
13:33 UTC
Read the original article
Hit count: 242
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?
© Stack Overflow or respective owner