cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
BertoL
Level 3

Windows service dependency changing

Let me simplify my question with a short example:

My installer needs to install 3 Windows services: service A, service B and service C

If a checkbox on a dialog is set during installation, the dependencies should be:

Service C is dependent on Service B and Service B itself is dependent on Service A

However If the user would switch off the checkbox during an installation:

Service B will not install and therefore Service C should be set dependent on Service A

What would be the best approach to implement this?

 

Labels (1)
0 Kudos
(2) Replies
banna_k
Revenera
Revenera

Hi @BertoL,

  You can control the service installation through the service component's condition in the components view, this condition can be set based on your check box state during installation. 

Condition

Basic MSI, DIM, InstallScript MSI, Merge Module, MSI Database, MSM Database, Transform

This setting lets you enter a statement that the installation must evaluate before setting up your component’s data on the target system. The component is not installed if its condition evaluates to false. However, the component is installed or advertised if its condition evaluates to true, assuming that its feature is selected for installation.

To create a condition for the component, click the ellipsis button (...) in this setting. For more information, see Configuring Component Conditions.

   

https://helpnet.flexerasoftware.com/installshield25helplib/helplibrary/ComponentSettings.htm

 

You can write custom action to set the dependencies of the services based on the condition variable set. Windows supports several ways to set/change the service dependencies, you can opt which is more optimal for your case and can be configured through the custom action.

Then custom action can be sequenced after the service installation to set the dependencies after the selective installation based on your condition.

 

0 Kudos

Thanks for the suggestion however I am trying to avoid using a script to set dependencies as the dependency information will not be stored in the related MSI table. 

What is your opinion on the following solution?

In the component holding a service, field "Dependencies": do not specify hard coded the dependent service name, but replace that field with a property (e,g, [ServiceC_Dependency]). And before services are being created by the installer, add a custom action to  set that property  to the correct dependent service name (based on the value of the checkbox).

 

 

0 Kudos