Ok I know you can do this in Inno Setup:
#define AppVer "0.0.11"
Then use it like
[Setup]
AppVerName={#AppVer}
Now imagine I have a file named VERSION whose contents are “0.0.11”.
Is there a way the contents of the file VERSION into the Inno Setup preprocessor variable somehow?
Using ISPP’s
GetFileVersionfunction is the preferred method (since your installer version should match your application’s version, after all). So if this is what you actually wanted to do, you should accept jachguate’s answer.In case you really do want to read the version from a text file instead of from the executable file, then there are two possibilities:
The first: If you can modify the internal format of the file, then you can simplify things considerably by making it look like an INI file:
Given this, you can use ISPP’s
ReadInifunction to retrieve the version:The second alternative, if you can’t change the file format, is to use the
FileOpen,FileRead, andFileCloseISPP functions, eg:I repeat, though: it’s better to get the app version from the executable file itself instead. This helps to ensure that everything matches up, for one thing.