How to read VersionInfoVersion of my installation to compare with existing version

In my installer, I have to check if the installed version is installed than the version of the application that is already installed on the computer.

If this is the case, I must close the installation program, preventing the installation.

So, I have this code below:

if GetVersionNumbersString(ExpandConstant('{app}\bin\application.exe'), Version) then begin ... end; 

This returns me the version number of the application on the computer. My question is:

How to find out information in VersionInfoVersion mySetup?

+4
source share
1 answer

To correctly compare version numbers, you will need to perform a numerical comparison of each component of the version number.

You can use ISPP GetFileVersion() to get the text version number that you set at compile time and {#emit...} it in PascalScript, or use PascalScript GetVersionNumbersString() at run time and pass ExpandConstants('{srcexe}') . You can then use the PascalScript function GetVersionNumbersString GetVersionNumbersString() again to get a replacement for the text version of the application.

If you have both values ​​in PascalScript string variables, you can use the CompareVersion() function to perform the actual comparison.

+4
source

Source: https://habr.com/ru/post/1480118/


All Articles