MyAppVersion - Reading first two parts of a version number

482 views
Skip to first unread message

Ertan Küçükoglu

unread,
Feb 10, 2022, 7:54:04 AM2/10/22
to innosetup
Hello,

Normally we can manually put in the version number 
#define MyAppVersion "35.832"
or read it from an EXE file 
#define MyAppVersion GetVersionNumbersString('MyApp.exe')

What I would like is to read just first two numbers out of four from a version string. For example
"9.3.0.147" should become "9.3"
"15.280.0.12345" should became "15.280"

Is it something that can be automized to be read out of exe with combination of some other functions? Or I need to write it manually in my ISS file?

Thanks & Regards,
Ertan

Gavin Lambert

unread,
Feb 10, 2022, 5:17:48 PM2/10/22
to inno...@googlegroups.com
Use GetVersionComponents instead.

Ertan Küçükoglu

unread,
Mar 19, 2022, 3:24:09 PM3/19/22
to inno...@googlegroups.com
I am pretty sure it is easier than what I am trying to do (which fails anyway)

I could not handle this myself. I tried the code below as my last try and this also seems not to work.

#define Major
#define Minor
#define Rev
#define Build
#define AppVerText GetVersionComponents('..\Win32\Release\MyApp.exe.exe', Major, Minor, Rev, Build), Str(Major) + "." + Str(Minor)

[Setup]
AppVersion={#AppVerText}

I do appreciate any help.

Thanks & Regards,
Ertan

Gavin Lambert <i...@mirality.co.nz>, 11 Şub 2022 Cum, 01:17 tarihinde şunu yazdı:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/74a0bdbd-a20f-dbc3-e180-4530ddd9d50a%40mirality.co.nz.

Eivind Bakkestuen

unread,
Mar 19, 2022, 6:07:33 PM3/19/22
to inno...@googlegroups.com
It might be your relative path that's not working, try with an absolute path?

Ertan Küçükoglu

unread,
Mar 19, 2022, 6:28:26 PM3/19/22
to inno...@googlegroups.com
After posing I figured that my EXE does not have a product version. It has FileVersion only.
I switch using ParseVersion() as below which is working just fine

#define Major
#define Minor
#define Rev
#define Build
#define MyAppVersion ParseVersion('..\Win32\Release\MyApp.exe', Major, Minor, Rev, Build), Str(Major) + "." + Str(Minor)
                                             
[Setup]                       
AppVersion={#MyAppVersion}

Thanks & Regards,
Ertan

Eivind Bakkestuen <eivind.b...@gmail.com>, 20 Mar 2022 Paz, 01:07 tarihinde şunu yazdı:

Laurent Combémorel

unread,
Mar 21, 2022, 5:44:20 AM3/21/22
to innosetup
The definition of MyAppVersion is not correct... Can you try the following?
#define Major
#define Minor
#define Rev
#define Build
# define FullVersionString GetVersionComponents('..\Win32\Release\MyApp.exe', Major, Minor, Rev, Build)
#define MyAppVersion Str(Major) + "." + Str(Minor)


bovirus

unread,
Feb 4, 2025, 3:56:55 AM2/4/25
to innosetup
Is it valid also Inno Setup 5.x?
Because it seems that " GetVersionComponents" is only for Inno Setup 6.x.
How can do that with inno Setup 5.x and get only 3 parts (x.x.x) of version?

Gavin Lambert

unread,
Feb 4, 2025, 5:05:41 PM2/4/25
to innosetup
On Tuesday, February 4, 2025 at 9:56:55 PM UTC+13 bovirus wrote:
Is it valid also Inno Setup 5.x?
Because it seems that " GetVersionComponents" is only for Inno Setup 6.x.
How can do that with inno Setup 5.x and get only 3 parts (x.x.x) of version?

GetVersionComponents was added in 6.x.  If you can't upgrade, you'll either have to use ParseVersion from ISPP or GetVersionNumbers at runtime. 
Reply all
Reply to author
Forward
0 new messages