Conditional Service Dependencies - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

benhinman
Posts: 37
Joined: Wed Aug 06, 2008 7:50 am

Conditional Service Dependencies

HI All,

I am looking to setup window service dependencies, based on feature installations. For example:

if Feature A with Service A is installed and
Feature B with Service B is installed:

-> I would like Service B to have Service A as a dependency.

If however Feature A (and therefore Service A) isn't installed:

-> I would like Service B to have no depedencies.

Strange request I know - the application can be distributed but if it isn't we would like ordered loading of the services without hacky scripting.

Thanks,
Ben
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Conditional Service Dependencies

Hi Ben,

I'm afraid that the ServiceInstall MSI table doesn't support conditional dependencies. However, what you need can be done by duplicating the service and Feature B:
- lets suppose you configured your project to install Service A (Feature A) and Service B (Feature B) and Service B has Service A as a dependency
- in the Services page create Service B again, without any dependencies
- in the Organization page create a new feature: Feature B - no dependecies
- add the no dependencies Service B to this feature
- share the components in Feature B (except Service B) with Feature B - no dependencies (you can use drag and drop while the SHIFT key is pressed)
- condition the features to be installed like this: if Feature A is installed then install Feature B, otherwise install Feature B - no dependencies

Inside the custom action which conditions the features you can use Session.FeatureRequestState to determine the feature action (if it will be installed or not).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
benhinman
Posts: 37
Joined: Wed Aug 06, 2008 7:50 am

Re: Conditional Service Dependencies

Thanks for the help.

I have just tried the following:

CustomAction type: Property set with Formatted in the install execute sequence which set's a property based on whether a feature is installed.

Use this property from in the service dependency text field.

This didn't work citing string argument cannot have a length of zero, implying that if I do type something in the depdency box, it better resolve to an existing service.

Given this idea, is there anything else I can do to hack it into working?

Addintionally:

- I already have .net custom actions running for each service I install. I could set depedencies up in there. All I need to know is whether my custom actions run before or after the services are setup. Thanks


Thanks again,
Ben
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Conditional Service Dependencies

Hi Ben,
Given this idea, is there anything else I can do to hack it into working?
Since this did not work, I'm not sure if there a way to make it work.
I already have .net custom actions running for each service I install. I could set depedencies up in there. All I need to know is whether my custom actions run before or after the services are setup.
Perhaps this is a better solution for what you need. In order to set the dependencies from the custom action, you need to schedule it after the "InstallExecuteSequence" -> "StartServices" standard action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”