MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Set global path and product details via command line parameter

Tue Feb 28, 2023 3:31 pm

Hi there,

1) We have a project set up and now we want to build it using our build pipeline from the command line. Currently, all files use absolute paths. To make this easier, my next steps would be to replace all paths with a global path (https://www.advancedinstaller.com/user- ... s-tab.html) using the handy wizard you provide to convert the paths. As this path changes depending on the chosen build at our build system, I would need a way to change a single path via a command line argument when building the project from command line. Is this possible?
So far I only found that I can provide an (previously saved) xml file with the adjusted paths: https://www.advancedinstaller.com/user- ... .html#path which is not ideal for us. Optimally I would be able to set this path via a command line parameter directly without having the need to store an xml file. Is such functionality available?

2) We also have the need to adapt the product details (product name and version) depending on a command line parameter. Is that possible too? This would allow us to have a single, easily maintainable, .aip file and build system calls the .aip file from the command line and builds it using a specific build config and product details.

Thanks in advance and all the best,
Johannes
Last edited by MGS on Wed Mar 01, 2023 1:20 pm, edited 3 times in total.

MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Re: Set global path via command line parameter

Tue Feb 28, 2023 5:13 pm

In addition to this, I wanted to point out that the documentation is out-of-date here:
https://www.advancedinstaller.com/user- ... s-tab.html

The text:
To convert the existing absolute paths to path variables use the Convert Paths wizard (“Project” -> “Convert Paths...”).
should be updated to (reflects the latest AI version 20.3.2):
To convert the existing absolute paths to path variables use the Convert Paths wizard (“Wizards” -> “Convert Paths”).

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

Re: Set global path and product details via command line parameter

Thu Mar 02, 2023 5:24 pm

Hello Johannes,

Regarding the path variables, please give me some more time to investigate and discuss this with our team.
2) We also have the need to adapt the product details (product name and version) depending on a command line parameter. Is that possible too? This would allow us to have a single, easily maintainable, .aip file and build system calls the .aip file from the command line and builds it using a specific build config and product details.
Regarding this, I'm afraid it might not be possible. Perhaps if you could create a script that retrieves the command line parameters and if yours is found, run the AdvancedInstaller.com tool with the required parameters to change the Product Name and Version.
In addition to this, I wanted to point out that the documentation is out-of-date here:
Thank you for bringing this to our attention!

I will forward it to our technical writing team and this should be fixed.

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

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

Re: Set global path and product details via command line parameter

Fri Mar 03, 2023 4:46 pm

Hello Johannes,

Unfortunately, I'm afraid we do not have predefined support for your request as for now.

However, I will add this on our TODO list of improvements and hopefully it will be implemented in a future version of Advanced Installer.

Thank you for your understanding!

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

MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Re: Set global path and product details via command line parameter

Mon Mar 06, 2023 9:24 am

Hello Catalin,

Thanks for your answers!

I found out that Powershell allows us to set the Product Name and Version very easily, so we switched to that:

Code: Select all

$project = $advinst.LoadProject($ai_path)
$project.ProductDetails.Name = "Product Name"
$project.ProductDetails.Publisher= "Publisher"
$project.ProductDetails.Version= "1.0.0"
Is it possible to set the global path variables using Powershell? If not directly (which would be best as it offers the most flexibility), then via an .xml file would also suffice for now. As we are just using a single .aip project file, setting the project path variables would work for us too.

All the best,
Johannes

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

Re: Set global path and product details via command line parameter

Mon Mar 06, 2023 12:01 pm

Hello Johannes,

Great, I am glad you managed to find a solution using our PowerShell support.
Is it possible to set the global path variables using Powershell? If not directly (which would be best as it offers the most flexibility), then via an .xml file would also suffice for now. As we are just using a single .aip project file, setting the project path variables would work for us too.
Regarding this, you could simply call AdvancedInstaller.com from your PowerShell script with the /loadpathvars argument.

For more information about this, please see the Start-Process cmdlet.

Hope it helps!

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

MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Re: Set global path and product details via command line parameter

Mon Mar 06, 2023 1:45 pm

Hi Catalin,

Thanks for the fast reply and the potential solution! I will make use of that for now.

For the future: Is it not yet possible with the new Powershell interface AI provides?
What I currently have is this:

Code: Select all

$advinst = New-Object -ComObject AdvancedInstaller
$ai_path = Join-Path -Path (Get-Location) -ChildPath "test.aip"
$project = $advinst.LoadProject($ai_path)
$project.ProductDetails.Name = "test product"
$project.ProductDetails.Publisher= "test publisher"
$project.ProductDetails.Version= "1.0.0"
$build_config = "TESTCONFIG"
$project.Rebuild($build_config)
And looking through the interface using Windows Powershell ISE I could find:

Code: Select all

$project.PropertyComponent.UserDefinedProperties
$project.PropertyComponent.Properties
In AI the project path variables are inside the Property view and thus I assume I should find related functionality inside the PropertyComponenet in Powershell. But there I could not find my project path variables nor anything related to them.

All the best,
Johannes

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

Re: Set global path and product details via command line parameter

Tue Mar 07, 2023 2:56 pm

Hello Johannes,

You are always welcome!
In AI the project path variables are inside the Property view and thus I assume I should find related functionality inside the PropertyComponenet in Powershell. But there I could not find my project path variables nor anything related to them.
You are indeed right about this.

I will add this on our TODO list of improvements and hopefully it will be implemented in a future version of Advanced Installer.

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

MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Re: Set global path and product details via command line parameter

Mon May 22, 2023 9:36 am

Hello Catalin,

Is there any news about this? I really need this functionality, which is missing in your Powershell interface, to move forward with our installer. I just checked again with AI 20.6. It would be great if this functionality could be implemented so that your Powershell interface is as powerful as the AI GUI itself.

All the best,
Johannes

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

Re: Set global path and product details via command line parameter

Mon May 22, 2023 3:52 pm

Hello Johannes,

I'm afraid it has not yet been implemented.

However, as far as I can see, the developer is working on adding PowerShell support for Path Variables.

I will update this thread as soon as I will have more information.

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

MGS
Posts: 83
Joined: Tue Oct 04, 2022 9:52 am

Re: Set global path and product details via command line parameter

Tue May 30, 2023 12:36 pm

Hello Catalin,

Thanks for the great news! Keep up the good work.

Best regards,
Johannes

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

Re: Set global path and product details via command line parameter

Tue May 30, 2023 12:54 pm

You are always welcome, Johannes!

And thank you for your kind words!

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

Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Set global path and product details via command line parameter

Thu Aug 17, 2023 2:18 pm

Hi Johannes,

The improvement about path variables support was added in Advanced Installer 20.9.1 that was released on August 8, 2023.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”