Hi,
I was building an installer yesterday (using v11.8 of AI) that has a PowerShell Custom Action. I wanted to pass in the value of the installation directory into the script so that it could invoke some other cmdlets that are bundled with the installer.
By default the installation path is C:\Program Files (x86)\MyCompany\MyApp - obviously this has a space in the path that needs to be dealt with. Without wrapping the script parameter property with " " as expected the PowerShell script fails because the file C:\Program cannot be found.
So on the second attempt I tried -installPath "[APPDIR]" but this resulted in the error file C:\Program Files (x86)\MyCompany\MyApp"\MyFile.ps1 cannot be found (note the " between the injected path and the file name).
In order to get the path to be resolved correctly I had to use the following (note the single "):
Script Parameters:
-installPath "[APPDIR]
Script:
param($installPath)
Write-Output $installPath
This feels like a bug, because it's not the behaviour I would expect. Can you confirm if this is an bug or an expected behaviour (I did waste a good couple of hours trying to figure out why this wouldn't work!)
Also it would be really good if your documentation could include a note that you need to add the param($installPath) element for each parameter you want to pass in, it should have been obvious, but it took me a while to figure out why I wasn't seeing anything being passed into the script!
Many thanks,
Howard
FOLLOW US
Get the latest news in Application Packaging