How do I automatically set the version of my Inno Setup installer according to my application version?

Salvador picture Salvador · Jun 27, 2011 · Viewed 22.5k times · Source

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}

Answer

RRUZ picture RRUZ · Jun 27, 2011

You can use the Inno Setup Preprocessor GetFileVersion function like this

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