[VS AddIn] How to embed version info?



  • Hello community!

    How do I embed version info into the .exe file?
    I first added an icon, that worked (but only if it's in the first line, can this be changed?)
    Then I added a version info resource (VS_VERSION_INFO VERSIONINFO ...) but after building, the .exe is still without it! I also tried to remove the .rc file and add it again.

    How can I do it? There is no .pro file or such... it's the Visual Studio Add-in :P
    Thanks!


  • Moderators

    This has nothing to do with Qt or addin actually. The version resurce should be put in the .rc file (not the Qt .qrc resource file). If your exe is not updating after resource change try one of these:

    • right click on the .rc file and select "Compile". After that link the solution.
    • find the generated .res file in your build directory and delete it. Link your solution again (this will force re-compiling resource)
    • Clean and Rebuild solution
    • Make absolutely positively sure that your "VERSION_INFO":http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx is correct. I found the hard way it's very fragile and doesn't tolerate the smallest errors. It doesn't generate any warnings or info, it just doesn't show in the .exe.


  • Thanks for your answer.
    Unfortunately, I was not able to fix it, tried all of your suggestions.
    The .res file is only 32 bytes, is that normal?

    When creating a normal Win32 GUI application, adding an icon, then a version resource, it just works!
    I remember I had that problem a longer time ago, with Visual Studio 2010 and Qt 4.6 or 4.8, now I'm using VS 2013 and Qt 5.3 beta.

    What could be wrong? I have also tried not to edit the .rc file (then, the .exe also has no icon...).


  • Moderators

    Hm, I just tried it with VS2013 and Qt 5.2.1 and it "just works". I doubt Qt 5.3 has anything to do with it as it's not a Qt feature. It's a Windows (or exe format) feature so Qt shouldn't matter at all.
    Could you try creating blank Qt widget application, add the version resource and see if it works?



  • Thank you, I tried with a blank project and it worked.

    I was able to fix it for my existing project, but only by removing/deleting the .rc and resource.h, then adding an icon and version resource again. Now, the .res file is about 35 KB instead of 32 byte only, the .exe got the icon and version info.

    But strange, I often have to re-add things to get them working, like for .ui files or there will be no generated ui_...h file for it. I also had to remove the .qrc and add it again, because resources weren't loaded :/

    // EDIT: Oh, when starting the application, no icon is show in the title bar or the alt+tab app switcher. I still have to manually edit the .rc file and move the icon definition to the top, and that everytime I edit an resource, the version for example... quite annoying. What causes this?


  • Moderators

    Yeah, as I said the resource system seems very fragile. I usually have a separate file just for the icon with a single line in it and don't use the VS editor for it:
    @
    IDI_ICON1 ICON "icon.ico"
    @
    It's curious that Qt won't recognize this for example if you change IDI_ICON1 to IDI_ICON2 or explicitly to something like 101.
    It also seems the builtin VS resource editor doesn't do a very good job as it sometimes duplicates IDs. For example it's common that it gives ID 101 to icon and other resources. Inspect generated .rc and resource.h files for such oddities.
    Oh well, another day with Visual Studio I guess ;)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.