How to automatically set the version of the Inno Setup installer according to the application version

inno-setup

I am using Inno Setup to generate the installer of my application. How can set the version number of the setup.exe (VersionInfoVersion) generated by Inno to match with the version number of my application automatically? Now every time I deploy a new version of my application I need to update the version number manually.

Now I'm doing this:

[Setup]
VersionInfoVersion=1.2.2.0 //writing the value manually

I want something like this:

[Setup]
VersionInfoVersion={Get the version of my app}

Best Answer

You can use the Inno Setup Preprocessor GetVersionNumbersString function like this

#define ApplicationName 'Application Name'
#define ApplicationVersion GetVersionNumbersString('Application.exe')
[Setup]
AppName={#ApplicationName}
AppVerName={#ApplicationName} {#ApplicationVersion}
VersionInfoVersion={#ApplicationVersion}
Related Topic