If you only will ever have one service you could try conditioning the StartServices action (based on the property you set in the UI) but you will need to ensure that it does the right thing with upgrades, with no UI (how do you want to default this?), with repairs, and with uninstalls (there shouldn't be anything that starts on uninstall, should there?). Action conditions (not based on platform) have been proven to often not be right in all circumstances, and are hard to get right, so they are often discouraged.
Further, if you might ever have more than one service you will not be able to distinguish them because the one action covers all components in the entire MSI, so it doesn't scale well. You really need per-service control. You could try separating your two ServiceControl elements in separate components, each of which is conditioned oppositely. <Component Id='TyrellForwarderService' Guid='*'> <File ...> <ServiceInstall ...> <ServiceControl Id='TyrellForwarderServiceNoStart' Name='Tyrell Forwarder' Stop='both' Remove='uninstall' Wait='yes'/> </Component> <Component Id='TyrellForwarderServiceStart' Guid='PLACE-GUID-HERE'> <Condition>INSTALLSERVICE = 1</Condition> <ServiceControl Id='TyrellForwarderServiceStart' Name='Tyrell Forwarder' Start='install' Wait='yes'/> </Component> If you wish to use the UI during minor upgrades/patches (and/or otherwise use the property to change your initial setting) you will need to make the TyrellForwarderServiceStart component Transitive. You should test whether you need to add some other keypath to that component as well, so it doesn't get ignored during upgrades/patches (since installer may think that it is already up-to-date). This builds, but I haven't tested it yet. -Blair -----Original Message----- From: Lewis99 [mailto:andrewhawke...@gmail.com] Sent: Thursday, September 17, 2009 9:08 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Start service based on user choice. Can someone tell me the best way to conditionally determine whether a service is started based on user input. I have added a checkbox 'Start Service' to the VerifyReadyDialog and want to use that selection to condition whether the service is started or not. My ServiceControl element looks like this <ServiceControl Id='TyrellForwarderService' Name='Tyrell Forwarder' Start='install' Stop='both' Remove='uninstall' Wait='yes'/> The start property only has enum values of install/uninstall/both so I don't see how I can use a property value here as it won't be recognised as a valid value. As you will know removing the start property stops the service from starting. So somehow I need to be able to condition the removal of the start property. Also, if I manually edit the MSI and add a condition to the StartServices InstallExecuteSequence row of And INSTALLSERVICE = 1 it works. So the question is - what is the best way to achieve this. Can I define two ServiceControl elements with different ID's and pick one at runtime somehow? Alternatively how do I set a condition on an InstallExecuteSequence row via WIX? Any advice on the best way to achieve this would be greatly appreciated. I am trying to get my head around both WIX and MSI's in general so I may be taking the wrong approach completely. Thanks -- View this message in context: http://n2.nabble.com/Start-service-based-on-user-choice-tp3664066p3664066.ht ml Sent from the wix-users mailing list archive at Nabble.com. ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users