How to Store File Information (Version) in Resource File for Delphi Projects


By Default, the Delphi IDE stores the file information (version) directly in compiled Resource File (*.res), which is binary so you can’t easily edit it using text editors.

delphi-project-options How to Store File Information (Version) in Resource File for Delphi Projects delphi windows

delphi-project-options

Sometimes, if you want to do version control on these information, then it is better to store directly in *.rc (resources file), which is a text file.

First, untick the [Include Version Information in Project] at Tab [Version Info], then create a text file *.rc and change the following accordingly.

1 VERSIONINFO
FILEVERSION 3,0,0,8
PRODUCTVERSION 3,0,0,8
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
  FILEFLAGS 0x1L
#else
  FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
   BLOCK "StringFileInfo"
   BEGIN
      BLOCK "080904e4"
      BEGIN
         VALUE "CompanyName", "Company"
         VALUE "ProductVersion", "3.0.0.8"
         VALUE "FileVersion", "3.0.0.8"
         VALUE "InternalName", "File (x64)"
         VALUE "OriginalFilename", "File.dll"
         VALUE "ProductName", "(x64) File"
         VALUE "FileDescription", "(x64) File"
         VALUE "LegalCopyright", "Company"
      END
   END
   BLOCK "VarFileInfo"
   BEGIN
      VALUE "Translation", 0x809, 1252
   END
END

Then right click the project explorer and add this file (*.rc) to the project tree. That is it! Now, the compiled executables (*.exe or *.dll) will contain the file version information detailed in *.rc file.

The Delphi Resources file compiler brcc32.exe is easy to use. For example,

brcc32.exe sample.rc

will generate a Win32 resource file sample.res. and you can also specify the output filename using command line options -fo.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
315 words
Last Post: Laptop Review: Lenovo Y50-70 Intel Core i7-4710HQ 2.5 GHz, 16 GB RAM, 4 GB Dedicated Graphics, 1 TB HDD, HDMI
Next Post: Simple Version Number Updating in Batch File for Build Scripts

The Permanent URL is: How to Store File Information (Version) in Resource File for Delphi Projects

Leave a Reply