fellz
27th December 2005 22:52 UTC
Read Version Information from MyApp.exe
Hi!
I am trying to read version information from my application's fileinfo. I want the installer to automatically show the Application's version (which is stored in MyApp.exe).
I tried it that way - without any success:
---
!include "FileFunc.nsh"
!insertmacro GetFileVersion
Section test
${GetFileVersion} "MyApp.exe" $R0
!define PRODUCT_VERSION "$R0"
SectionEnd
---
Any clues what's wrong here?
Many thanks in advance!
Chris
Afrow UK
28th December 2005 13:07 UTC
Make sure you specify a full path and not a relative one.
-Stu
fellz
28th December 2005 16:02 UTC
thanks,
i also tried using a full path before - without luck :-(
and yes, windows explorer shows the version information of the .exe - so this should be ok as well (even the my program itself reads it from the exe)
Afrow UK
28th December 2005 16:59 UTC
O.K. I see your problem I think.
Check the value of $R0 in your Section (e.g. with a MessageBox). It should be correct.
Now, the problem is that you are defining PRODUCT_VERSION as $R0. As soon as you change the value of $R0, PRODUCT_VERSION will also be changed. PRODUCT_VERSION is not a variable. It's just a constant and when you compile your installer, all instances of ${PRODUCT_VERSION} will be replaced with $R0.
The best thing to do here would be to define a PRODUCT_VERSION variable with the Var instruction, and use that instead of $R0. The PRODUCT_VERSION define will no longer be necessary.
-Stu