Aradial
Posts: 5
Joined: Thu Oct 18, 2012 9:13 am

Conditional Services

Hi,

i would like to condition what services to install based upon selection during the UI.
however i don't see any condition in the service page, and i cant condition the component without skipping over the exe files.

is there any solution?

thanks in advance
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Conditional Services

Hello,

In order to achieve this you can condition the related service component installation. Here's the steps to proceed:
- Go to "Dialogs" page, create a new dialog and add a check box control like this:
  • Text: Install service
    Value: checked
    Property Name: MY_PROP
- Go to "Organization" page, select the related service component and in the "Condition" field, from "Component Properties" right pane, add the following condition:
  • Condition: MY_PROP = "checked"
- Build and run your project.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Aradial
Posts: 5
Joined: Thu Oct 18, 2012 9:13 am

Re: Conditional Services

Hi

unfortunately i am not able to condition the resource without effecting the other files in the component.
i would like to condition the installation of the service, not the installation of the file which the service relates to.
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Conditional Services

Hello,

In order to achieve this you can proceed like this:
- Go to "Table Editor" page and select the "InstallExecuteSequence" table.
- Select the "InstallServices", "StartServices", "DeleteServices" and "StopServices" standard action rows and in the "Condition" field set your desired condition.
- Build and run your project.

Please keep in mind that our "Table Editor" feature is available only in an "Enterprise" or above license. Also, when use this approach, then all the services added on our "Services" page will not be installed when the related condition is true.

If your project contains more service installations and you want that only a specific service to be installed based on conditions ,then you should add the related service resources in "Files and Folders" page. After that you can create your own custom action which will install and configure the service when a related condition is true. Also, the custom action should be added after "Install Execution Stage -> Add Resources" action group and should run as "Deferred with no impersonation".

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Aradial
Posts: 5
Joined: Thu Oct 18, 2012 9:13 am

Re: Conditional Services

Thank you very much
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Conditional Services

You're welcome. Glad to help.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
citiz
Posts: 2
Joined: Wed Oct 18, 2023 11:47 am

Re: Conditional Services

Hi,

I've just follow the specified procedure because, as Aradial I need to be able to install my Java App as a Console App or as a Service App.

To acheive this:
- I created a dialog mapped to a property INSTALL_MODE with a combo group (combo1 = console, combo1 = service)
- I added a conditon inside the Organisation INSTALL_MODE = "console" (for console app), INSTALL_MODE = "service" (for service app).

From here it works as expected.

Now, I need the service to be managed during the install/remove only if the condition INSTALL_MODE = "service". To achevie this I updated the table editor as described by adding

Code: Select all

 (VersionNT) AND (INSTALL_MODE = "service")
to InstallService, StartService, RemoveService and Delete Service condition column.

Please note that by default the condition VersionNT is set inside the condition column.

But now, in both case (INSTALL_MODE = "service" or INSTALL_MODE = "console") the service is never installed.

Is there somehing I missed or misunderstanding ?

Thank you for you help

Regards
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditional Services

Hello and welcome to our forums,

What I think we can do here to achieve what you want is the following:

- add the EXE twice in the setup package, e.g.:

1. go to "Files and Folders" page and create two folders under "Application Folder"

2. for each folder, right click --> "Properties" --> check "Install folder content into parent folder" option

- in "Services" page, select one of the two EXEs to create the service for - in our case, we selected the EXE from folder1
Screenshot_71.png
Screenshot_71.png (79.33 KiB) Viewed 4477 times
- in "Organization" page, we will condition the installation of the component assigned to each EXE based on the Radio Button Control.
Screenshot_72.png
Screenshot_72.png (38.54 KiB) Viewed 4477 times

So basically, we have the following logic now:

- if user selects Service, then the EXE from folder1 will be installed and the service will be created

- if user selects Console, then the EXE from folder2 will be installed and the service will not be created (because the service operations are meant to execute for the EXE in folder1, so if that EXE is not installed, service will also not be installed).

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
citiz
Posts: 2
Joined: Wed Oct 18, 2023 11:47 am

Re: Conditional Services

Hi,

Thank you but it's exactly what i've done.

My problem is not the exe iteself, because the "service" vs "console" exe are installed as expected but when the "service" exe is installed the Windows Service is not deployed. Maybe the problem comes from the Table Editor because the condition content is not really clear (or maybe I also need to create a custom action ?).

For the 'installExecuteSequance/installServices' action in the TableEditor, the action is executed if the condition is TRUE or FALSE ?

Why I ask this it's just because my App is only a x64 app only and I saw inside the 'installeServices' condition the value 'VersionNT' means x86. Due to this, I thought that the condition must be FALSE to be executed (which is a little bit confusion, isns't it ?!)

Regards
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditional Services

Hello,

Please note that VersionNT does not necessarily mean the system is 32-bit.
The installer sets the VersionNT property to the version number for the operating system, undefined if the operating system is not Windows NT, Windows 2000, Windows XP, Windows Vista, Windows Server 2008, or Windows 7. The value is an integer: MajorVersion * 100 + MinorVersion.
We decide that through the VersionNT64, either:

Code: Select all

VersionNT64 --> system is 64
or

Code: Select all

NOT VersionNT64 --> system is NOT 64
That being said, the reason why service is not installed is not because of that.

In order for me to further investigate this, please forward me the following resources:

- a copy of the AIP File

- a download link for the setup

- a test-case

by email at support at advancedinstaller dot com.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”