Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to add version details to .exe or .dll
Forum Updated to NodeBB v4.3 + New Features

How to add version details to .exe or .dll

Scheduled Pinned Locked Moved General and Desktop
12 Posts 9 Posters 40.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    szuzsq
    wrote on last edited by
    #2

    add the statement into *.pro file as below:
    VERSION = 1.2.3.4

    It is successful at MS Win32 system

    1 Reply Last reply
    2
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #3

      google lead me "here":http://qtcreator.blogspot.com/2009/10/generating-automatic-version-numbers.html to generate version numbers automatically!


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #4

        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

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • I Offline
          I Offline
          Indrajeet
          wrote on last edited by
          #5

          Hi Gerolf

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

          1 Reply Last reply
          0
          • U Offline
            U Offline
            Uthering
            wrote on last edited by
            #6

            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>

            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
            @

              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

            :o)

            D 1 Reply Last reply
            0
            • I Offline
              I Offline
              Indrajeet
              wrote on last edited by
              #7

              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.

              1 Reply Last reply
              0
              • U Offline
                U Offline
                Uthering
                wrote on last edited by
                #8

                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 )

                1 Reply Last reply
                0
                • AlicemirrorA Offline
                  AlicemirrorA Offline
                  Alicemirror
                  wrote on last edited by
                  #9

                  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 ?

                  Enrico Miglino (aka Alicemirror)
                  Balearic Dynamics
                  Islas Baleares, Ibiza (Spain)
                  www.balearicdynamics.com

                  1 Reply Last reply
                  0
                  • Chris_1981C Offline
                    Chris_1981C Offline
                    Chris_1981
                    wrote on last edited by
                    #10

                    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?

                    1 Reply Last reply
                    0
                    • U Uthering

                      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>

                      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
                      @

                        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

                      :o)

                      D Offline
                      D Offline
                      Donald Duck
                      wrote on last edited by
                      #11

                      @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

                      hskoglundH 1 Reply Last reply
                      0
                      • D Donald Duck

                        @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

                        hskoglundH Offline
                        hskoglundH Offline
                        hskoglund
                        wrote on last edited by
                        #12

                        @Donald-Duck you can look at this thread

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved