2
votes

I have created setup for Windows desktop WPF/C# application using Inno Setup 6.0 and it works fine. Just a small cosmetic issue - I would like to use a "semantic version". The version number in Windows has four components, major.minor.build.revision but I want to present major.minor.patch. The fourth component will be used by CI and has no relevance for user. In the current script, I have this:

#define AppVersion GetFileVersion("..\app\bin\Release\app.exe")
... which later gets used as:
[Setup]
AppVersion=AppVersion
OutputBaseFilename=app.{#AppVersion}.x64

The result is app.1.0.1.781.x64.exe created by Inno Setup, so I'm looking for a way to cut off the last version component - .781. So far I haven't figured out how to invoke a script function for that purpose. I could add function in [Code] section but it will be defined after [Setup] section and apparently cannot be called in [Setup] section?

Is it possible to modify the values of AppVersion and OutputBaseFilename in Pascal script, for instance in InitializeSetup()?

1

1 Answers

3
votes

You can use GetVersionComponents preprocessor function (ParseVersion before Inno Setup 6.1):

#define AppVerText() \
   GetVersionComponents('..\app\bin\Release\app.exe', \
       Local[0], Local[1], Local[2], Local[3]), \
   Str(Local[0]) + "." + Str(Local[1]) + "." + Str(Local[2])

Then you can use this in your [Setup] section:

AppVersion={#AppVerText}

You can use this for OutputBaseFilename too:

OutputBaseFilename=app.{#AppVerText}.x64