Search code examples
delphiembedded-resourceexplorerfileversioninfodelphi-11-alexandria

VS_VERSION_INFO not showing in Windows Explorer after switching to Windows SDK Resource Compiler


I use a RC (resource) file to get version information linked into the EXE file, and recently I switched from Borland Resource Compiler to Windows SDK Resource Compiler, in order to be able to use multiple sizes icons in my application.

The icon worked, but now when I compile my application the resource information seems to not be attached to the EXE file. I'm suspecting that the same RC file that works for BRCC32.EXE does not work for the Windows SDK Resource Compiler.

Here is my verinfo.rc content:

VS_VERSION_INFO VERSIONINFO
FILEVERSION             1,0,0,0
PRODUCTVERSION          1,0,0,0
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
        VALUE "Comments",         "Company Soft\0"
        VALUE "CompanyName",      "Company2\0"
        VALUE "FileDescription",  "Company Soft\0"
        VALUE "FileVersion",      "x.x.x.x\0"
        VALUE "InternalName",     "Company Soft\0"
        VALUE "LegalCopyright",   "Company2\0"
        VALUE "OriginalFilename", "abrev.exe\0"
        VALUE "ProductName",      "Company Soft\0"
        VALUE "ProductVersion",   "x.x.x.x\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0409,1200
    END
END

And here is how my EXE file shows in Explorer's file properties: Explorer file properties showing no EXE version information

Finally, I'm not forgetting to use the verinfo.rc file in my Delphi project file:

program myprogram;
{$R 'verinfo.res' 'verinfo.rc'}

Update #1

If I change the resource compiler back from Windows SDK Compiler to Borland Resource Compiler the version information is included into the EXE file (but I cannot use multiple sizes icons anymore): Delphi project settings: Resource Compiler Explorer file properties showing EXE version information as wanted

Update #2

Using the resource editor Resource Hacker I can see there is indeed version information resource in the EXE file. But I can't see this in Windows Explorer, and also can't retrieve this with a WinAPI function like GetFileVersionInfo: Resource Hacker displays VS_VERSION_INFO resource

Update #3

Here is what I found what happens when using the same RC file but with different resource compilers:

  1. When using Borland Resource Compiler everything works fine, with the version info shown in Windows Explorer; Resource Hacker shows this:

    Resource Hacker showing resource "1"

  2. When using Windows SDK Resource Compiler version information still shows in Resource Hacker but not in Windows Explorer:

    Resource Hacker showing resource "VS_VERSION_INFO"


Solution

  • Version resource in DLL not visible with right-click fixed the issue: Basically I changed the first line of my .rc file from

    VS_VERSION_INFO VERSIONINFO
    

    to

    1 VERSIONINFO
    

    Now everything works!