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!

rmoc
Posts: 72
Joined: Tue Mar 14, 2017 8:27 pm

AI COM-Interface: Launch conditions

I’m trying to disable IIS via the COM interface LaunchConditionsComponent depending on the desired setup.

Code: Select all

advinstProject.LaunchConditionsComponent.SoftwareLaunchConditions.IIS = null;
The problem is that this setting is also tied to the specific Build being used. However, I can’t find a way to specify the Build for which I want to change this setting within the LaunchConditionsComponent.

Sample code and project
DeleteFeatures.zip
(8.32 KiB) Downloaded 169 times
Regards,
René
Liviu
Posts: 1420
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: AI COM-Interface: Launch conditions

Hello René,

At the moment, there isn’t a direct option in the LaunchConditionsComponent interface to choose a specific build.

However, I noticed that the option always applies to the currently selected build. Fortunately, we can programmatically select the build first, and then apply the launch condition command.

Here’s an example:

Code: Select all

$advinst = New-Object -ComObject AdvancedInstaller
$advinstProject = $advinst.LoadProject("C:\DeleteFeatures.aip")

# Get the desired build object by name
$desiredBuild = $advinstProject.BuildComponent.Builds | Where-Object { $_.Name -eq "DefaultBuild" }

# Set it as the selected build
$advinstProject.BuildComponent.SelectedBuild = $desiredBuild

# Verify
$advinstProject.BuildComponent.SelectedBuild.Name

$advinstProject.LaunchConditionsComponent.SoftwareLaunchConditions.IIS = "Internet Information Services 10.0"
$advinstProject.Save()

$advinstProject.LaunchConditionsComponent.SoftwareLaunchConditions.IIS = ""

If the value is empty, the launch condition will be removed.

I tested this on my side and it worked as expected.

Let me know if that helped.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rmoc
Posts: 72
Joined: Tue Mar 14, 2017 8:27 pm

Re: AI COM-Interface: Launch conditions

Hello Liviu,

that’s exactly what I was looking for. Thank you, it works perfectly. :D

Kind regards,
René
Liviu
Posts: 1420
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: AI COM-Interface: Launch conditions

You're always welcome, René!

Glad I could help! :D

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”