Hello Jenelle,
From what I understand here, you would like to get the version attribute from an executable and, based on that version fail the installer (please correct me if I'm wrong).
Unfortunately, we do not have predefined support for such a task. However, we can achieve this through a
custom approach.
For instance, we can have a custom action (e.g. PowerShell script, VBScript, C#, C++, etc.) that will retrieve the version form our file and then
store it in a property. That property can further be used to decide whether we continue with the installation or not.
For instance, a PowerShell script which would achieve this is:
Code: Select all
# Block for declaring the script parameters.
Param()
# Your code goes here.
Add-Type -AssemblyName PresentationFramework
$exePath = "C:\Users\Catalin\Desktop\sample.exe"
# replace ',' character with the '.' character, as a version number is usually separated by a dot rather than a comma
$exeVersion = (get-item -path $exePath).VersionInfo.FileVersion.Replace(',','.')
# remove the spaces from the string (e.g. 1. 0. 0. .1 --> 1.0.0.1)
$exeVersion = $exeVersion.Replace(" ","")
AI_SetMsiProperty ACCESS_VERSION $exeVersion
In order to implement this in Advanced Installer, please proceed as it follows:
- go to "Custom Actions" page
- add a "Run PowerShell inline script" custom action, with sequence
- schedule the custom action before the "Searches" action group, under the "Wizard Dialogs Stage"
- copy paste the code given above and replace the path with your path
One thing to be noted here is the file redirection, which we must keep in mind. As you stated in your thread, the files is located in the "ProgramFilesFolder", which can either be resolved to:
WinDrive\Program Files
or to:
WinDrive\Program Files(x86)
Now, we can use the property from our script (ACCESS_VERSION) to create a custom launch condition. For instance, if we need the version to be bigger than, let's say, 7.0, the condition could look like this:
This way, the setup will only continue only if the found version is > 7.0, otherwise if it is lower, it will fail.
Hope this helps.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging