Qt World Summit: Register Today!

How to add version details to .exe or .dll

  • Hi All

    Can anyone show me how to add version details to .exe or .dll files.

  • add the statement into *.pro file as below:

    It is successful at MS Win32 system

  • 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

  • Hi Gerolf

    Can you please give me steps how to do that I am not getting how to start.

  • Look, I can show how I've added rc into my recent project.

      1. Create proj.rc file with content like this:

    #include <windows.h>

    FILEVERSION 0, 1, 0, 2
    PRODUCTVERSION 0, 1, 0, 0
    BLOCK "VarFileInfo"
    VALUE "Translation", 0x409, 1200
    BLOCK "StringFileInfo"
    BLOCK "040904b0"
    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"

      1. Add to the *.pro file string like this
        win32:RC_FILE = proj.rc
      1. Build&run, your *.exe will have version&other fields by left-clicking -> properties on the file


  • Hi Uthering

    As in your code you have added windows.h,does it mean it is windows specific code?
    If so how to do it in generic so that is run my code on any OS it should not create any problem.

  • 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 = 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?

  • @Uthering This doesn't work. I did this and when I right click on the project file I still get the verion to

  • @Donald-Duck you can look at this thread

Log in to reply