How to add version details to .exe or .dll
-
google lead me "here":http://qtcreator.blogspot.com/2009/10/generating-automatic-version-numbers.html to generate version numbers automatically!
-
If you need full version info like file name, vendor name etc. in a MS compatible way, you have to "add an RC file to your project":http://doc.qt.nokia.com/4.7/qmake-variable-reference.html#rc-file and put the version info ( http://msdn.microsoft.com/en-us/library/aa381058(v=VS.85).aspx ) there
-
Look, I can show how I've added rc into my recent project.
-
- Create proj.rc file with content like this:
@
#include <windows.h>VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 1, 0, 2
PRODUCTVERSION 0, 1, 0, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Company\0"
VALUE "FileDescription", "File Description\0"
VALUE "FileVersion", "0.0.1-alpha\0"
VALUE "InternalName", "Filename\0"
VALUE "LegalCopyright", "Copyright 2011 by Company\0"
VALUE "OriginalFilename", "Filename.exe\0"
VALUE "ProductName", "Very cool project\0"
VALUE "ProductVersion", "0.0.1-alpha\0"
END
END
END
@-
- Add to the *.pro file string like this
@
win32:RC_FILE = proj.rc
@
- Add to the *.pro file string like this
-
- Build&run, your *.exe will have version&other fields by left-clicking -> properties on the file
:o)
-
-
bq. As in your code you have added windows.h,does it mean it is windows specific code?
afaik, version/build number is windows specific features ;o) at least ELF files doesn't contains such info =o)
you can exclude windows.h file from .rc file, yet you should be able to provide int instead of some defines =o) just try ) -
Thus reading this post and other related to the same problem in symbin I should conclude that for every platform a different versioning shouldb e set ?
In a multiplatform environment is it possible to set all these different methos coexisting in the same project ?
-
Hi,
I'm very interested in the versioning feature, too.
I tried the .rc file solution above but no version info appears. The VERSION = 1.2.3.4 statement in the .pro file doesn't work either.My configuration:
- Qt 5.0.1 (msvc2010)
- Microsoft Visual C++ Compiler 10.0 (x86)
- Windows 7 x64
Thanks for you help in advanced.
Edit: Now both solutions work after deleting all temporary files by hand. (Rebuild is not enough, I guess)
Edit2: Is there a qt function to read the version of a file platform independent? -
Look, I can show how I've added rc into my recent project.
-
- Create proj.rc file with content like this:
@
#include <windows.h>VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 1, 0, 2
PRODUCTVERSION 0, 1, 0, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Company\0"
VALUE "FileDescription", "File Description\0"
VALUE "FileVersion", "0.0.1-alpha\0"
VALUE "InternalName", "Filename\0"
VALUE "LegalCopyright", "Copyright 2011 by Company\0"
VALUE "OriginalFilename", "Filename.exe\0"
VALUE "ProductName", "Very cool project\0"
VALUE "ProductVersion", "0.0.1-alpha\0"
END
END
END
@-
- Add to the *.pro file string like this
@
win32:RC_FILE = proj.rc
@
- Add to the *.pro file string like this
-
- Build&run, your *.exe will have version&other fields by left-clicking -> properties on the file
:o)
@Uthering This doesn't work. I did this and when I right click on the project file I still get the verion to 0.0.0.0
-
-
@Uthering This doesn't work. I did this and when I right click on the project file I still get the verion to 0.0.0.0
@Donald-Duck you can look at this thread