Auto Increment Version Information Pre-build tool for Delphi XE2 using VerInfo

,

In Delphi XE2, the “Auto Increment build number” of Version Information is changed to Auto generate build number, replace Release and Build part with random numbers which is actually a time stamp of the time it’s generated.

I coded this little utility for my purpose, because I need/like an auto increment build number as a simple mean to track the build number, not some numbers that “look” random.

VerInfo is trying to help to do Auto Increment build number in Delphi XE2.

First download and copy “verinfo.exe” to your path, find download link below, for easy access to VerInfo it’s good idea to add it to IDE Tools:

Create Version Information Resource script either using text editor, or better yet, launch VerInfo and fill the form:

Then save the RC file to your project folder, the same folder as .dpr file, with an easy to recognize name, I usually name it <ProjectName>Ver.rc, eg: SLauncherVer.rc for my SLauncher program. For this example, here on, we use SLauncher project.

VerInfo uses and produces minimal Version Info RC file, eg:

// verinfo100-indrayn.com
// autoincbuild: 1
// autoincrelease: 0
 
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,108
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
#else
FILEFLAGS 0x8L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "040904b0"
    BEGIN
      VALUE "CompanyName", "indrayn.com\000"
      VALUE "FileDescription", "File macem-macem\000"
      VALUE "FileVersion", "1.0.0.108\000"
      VALUE "InternalName", "macem2.exe\000"
      VALUE "LegalCopyright", "Copyright 2012 dewa indrayana\000"
      VALUE "LegalTrademark", "\000"
      VALUE "OriginalFilename", "macem2.exe\000"
      VALUE "ProductName", "macem2\000"
      VALUE "ProductVersion", "1.0.0.1\000"
      VALUE "Comments", "good good\000"
    END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 1200
  END
END

After we have SLauncherVer.rc, we need to add this file to our project:

  • Right-Click on SLauncher project, choose [Add], [Resource file (*.rc)] file type, select SLauncherVer.rc
  • SLauncherVer.rc will be added to project
  • and Delphi will edit Project source and add the needed line.

Next, we need to update the Project Option:

  • Uncheck the “Include version information in project”
  • Add command “verinfo” to “Pre-build events”, to increment File Version build number in SLauncherVer.rc
    • we will add “verinfo $(INPUTDIR)SLauncherVer.rc /update”

  • First public release

Leave a Reply

Your email address will not be published. Required fields are marked *