Re: [WiX-users] Installing a Service with Varying Dependencies
Hi, for conditional service dependencies please have a look at the thread "[WiX-users] Conditional service installation" regards Stefan Erv Walter wrote: > We're struggling with a problem, and I'm curious if anyone has any > creative solutions they can think of. > > We have a windows service that our MSI installs. This service does some > things with MSMQ. We want to ensure that our service has the > appropriate ServiceDependency so that Windows starts things in the > correct order during system startup. > > Our WiX structure looks something like this (attributes removed to > simplify): > > > > > > > > > > > > Now, in the next version of our product, the MSMQ related functionality > is optional and we will have many customers who will not need or care > about the MSMQ functionality. We'd like to detect if MSMQ is installed > and make sure that the service is installed with the MSMQ dependency > only if MSMQ is installed (else the service won't start when MSMQ is not > installed). > > The first attempt to accomplish this with WiX was to have two nearly > identical components and use conditions to choose only the correct one: > > > > > > > > > > MSMQ_IS_INSTALLED > > > > > > > > > NOT MSMQ_IS_INSTALLED > > > This doesn't work (in WiX v2) because of the . We use > ServiceConfig to set the restart options correctly. WiX tries to put two > rows in the ServiceConfig table both with the same ServiceName. This > fails because ServiceName is the primary key and the second row errors > out as a duplicate. > > So, the next attempt was to move the ServiceConfig element to a > separate, shared Component that would always get installed regardless of > if MSMQ was needed or not. This compiles into an MSI but fails at > install time because the NewService column in the ServiceConfig table is > set to 0 and the SchedServiceConfig custom action has code to verify > that the service actually exists and this check runs before the > installations script is executed (and so the service hasn't been > installed yet). > > I don't like any of the options we're currently exploring, so I'm > looking for any brainstorming ideas. > > Options we're currently looking at: > > 1. Using to add the ServiceConfig table with the single > row we need and with NewService set to 1 and adding SchedServiceConfig > to the sequence ourselves. Yuck. > > 2. Dropping the dependency from the ServiceInstall completely and adding > a custom action to conditionally call sc.exe to add the dependency back > if MSMQ is installed. Bleh. > > 3. Dropping the dependency from the ServiceInstall completely and adding > code to our service itself so that when it starts up, it ensures that > MSMQ is running and attempt to start it if it isn't already running. > Windows won't know that our service depends on MSMQ, but we'll try to > replicate the logic that Windows would have used. Bummer. > > Any other suggestions? Note, we haven't looked at WiX v3 yet (that's on > my list for today) to see if there is some new way around this issue > there. > > Thanks, > Erv > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ___ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > > __ NOD32 1.1675 (20060723) Information __ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > > -- Stefan Pavlik | [EMAIL PROTECTED] Whitestein Technologies | www.whitestein.com Panenska 28 | SK-81103 Bratislava | Slovak Republic Tel +421(2)5930-0735 | Fax +421(2)5443-5512 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users
Re: [WiX-users] Installing a Service with Varying Dependencies
The Dependencies column of the ServiceInstall table has type Formatted. Maybe it's possible to use Properties SVCDEP1 and SVCDEP2 could be set with a custom action which can have the conditions you need. Regards, Martin > -Original Message- > From: [EMAIL PROTECTED] [mailto:wix-users- > [EMAIL PROTECTED] On Behalf Of Erv Walter > Sent: Dienstag, 18. Juli 2006 18:13 > To: wix-users@lists.sourceforge.net > Subject: [WiX-users] Installing a Service with Varying Dependencies > > We're struggling with a problem, and I'm curious if anyone has any > creative solutions they can think of. > > We have a windows service that our MSI installs. This service does > some things with MSMQ. We want to ensure that our service has the > appropriate ServiceDependency so that Windows starts things in the > correct order during system startup. > > Our WiX structure looks something like this (attributes removed to > simplify): > > > > > > > > > > > > Now, in the next version of our product, the MSMQ related functionality > is optional and we will have many customers who will not need or care > about the MSMQ functionality. We'd like to detect if MSMQ is installed > and make sure that the service is installed with the MSMQ dependency > only if MSMQ is installed (else the service won't start when MSMQ is > not installed). > > The first attempt to accomplish this with WiX was to have two nearly > identical components and use conditions to choose only the correct one: > > > > > > > > > > MSMQ_IS_INSTALLED > > > > > > > > > NOT MSMQ_IS_INSTALLED > > This doesn't work (in WiX v2) because of the . We use > ServiceConfig to set the restart options correctly. WiX tries to put > two rows in the ServiceConfig table both with the same ServiceName. > This fails because ServiceName is the primary key and the second row > errors out as a duplicate. > > So, the next attempt was to move the ServiceConfig element to a > separate, shared Component that would always get installed regardless > of if MSMQ was needed or not. This compiles into an MSI but fails at > install time because the NewService column in the ServiceConfig table > is set to 0 and the SchedServiceConfig custom action has code to verify > that the service actually exists and this check runs before the > installations script is executed (and so the service hasn't been > installed yet). > > I don't like any of the options we're currently exploring, so I'm > looking for any brainstorming ideas. > > Options we're currently looking at: > > 1. Using to add the ServiceConfig table with the single > row we need and with NewService set to 1 and adding SchedServiceConfig > to the sequence ourselves. Yuck. > > 2. Dropping the dependency from the ServiceInstall completely and > adding a custom action to conditionally call sc.exe to add the > dependency back if MSMQ is installed. Bleh. > > 3. Dropping the dependency from the ServiceInstall completely and > adding code to our service itself so that when it starts up, it ensures > that MSMQ is running and attempt to start it if it isn't already > running. > Windows won't know that our service depends on MSMQ, but we'll try to > replicate the logic that Windows would have used. Bummer. > > Any other suggestions? Note, we haven't looked at WiX v3 yet (that's > on my list for today) to see if there is some new way around this issue > there. > > Thanks, > Erv > > --- > -- > Take Surveys. Earn Cash. Influence the Future of IT Join > SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVD > EV > ___ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users
[WiX-users] Installing a Service with Varying Dependencies
We're struggling with a problem, and I'm curious if anyone has any creative solutions they can think of. We have a windows service that our MSI installs. This service does some things with MSMQ. We want to ensure that our service has the appropriate ServiceDependency so that Windows starts things in the correct order during system startup. Our WiX structure looks something like this (attributes removed to simplify): Now, in the next version of our product, the MSMQ related functionality is optional and we will have many customers who will not need or care about the MSMQ functionality. We'd like to detect if MSMQ is installed and make sure that the service is installed with the MSMQ dependency only if MSMQ is installed (else the service won't start when MSMQ is not installed). The first attempt to accomplish this with WiX was to have two nearly identical components and use conditions to choose only the correct one: MSMQ_IS_INSTALLED NOT MSMQ_IS_INSTALLED This doesn't work (in WiX v2) because of the . We use ServiceConfig to set the restart options correctly. WiX tries to put two rows in the ServiceConfig table both with the same ServiceName. This fails because ServiceName is the primary key and the second row errors out as a duplicate. So, the next attempt was to move the ServiceConfig element to a separate, shared Component that would always get installed regardless of if MSMQ was needed or not. This compiles into an MSI but fails at install time because the NewService column in the ServiceConfig table is set to 0 and the SchedServiceConfig custom action has code to verify that the service actually exists and this check runs before the installations script is executed (and so the service hasn't been installed yet). I don't like any of the options we're currently exploring, so I'm looking for any brainstorming ideas. Options we're currently looking at: 1. Using to add the ServiceConfig table with the single row we need and with NewService set to 1 and adding SchedServiceConfig to the sequence ourselves. Yuck. 2. Dropping the dependency from the ServiceInstall completely and adding a custom action to conditionally call sc.exe to add the dependency back if MSMQ is installed. Bleh. 3. Dropping the dependency from the ServiceInstall completely and adding code to our service itself so that when it starts up, it ensures that MSMQ is running and attempt to start it if it isn't already running. Windows won't know that our service depends on MSMQ, but we'll try to replicate the logic that Windows would have used. Bummer. Any other suggestions? Note, we haven't looked at WiX v3 yet (that's on my list for today) to see if there is some new way around this issue there. Thanks, Erv - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users