views:

177

answers:

1

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?

+3  A: 

The Start field in the ServiceInstall table isn't formatted so what you are putting in with a property will not work. This link has some helpful suggestions that might get you through it: ServiceInstall - Start element. Looks like the person who posted had the same issue. My favorite suggestion they provide is to create a custom action that runs before InstallServices action that will change the value of the Start element in the Service Install table.

Scott Boettger
Thanks for the link/info. I'll do as suggested with a CA I think.
Jamiec
I find that a lot my questions can be answered by those guys. Here another good site that I use often. http://blogs.technet.com/alexshev/pages/from-msi-to-wix.aspx
Scott Boettger