Ramblings

Delphi Programming Observations

Friday, May 6, 2011

Compiling SetVersion.exe with a Delphi before Delphi 2009

Compiling SetVersion.exe

Several people have emailed me to get a compiled version of SetVersion.exe, or with problems when they try to compile with a version of Delphi before 2009.

The developer of the DelphiPackageTool has a compiled version available at http://delphipackageto.svn.sourceforge.net/viewvc/delphipackageto/bin/SetVersion.exe?view=log, you should be able to click the download link on that page.

If you would like to compile it yourself, you should be able to follow these steps:

Clone the git repo

git clone https://github.com/jasonpenny/democode

Now you should be able to open the SetVersion.dpr at democode/SetVersion/

Get the older version of Colin Wilson’s resource code, go to http://www.wilsonc.demon.co.uk/ ,
for Delphi 2006 and Delphi 2007: click on Delphi 2006, then download these files

Take files from those zip files and replace the same named files at democode/Others/ColinWilson/

  • ImageTypes100
    • unitEXIcon.pas
  • ResourceUtils100
    • unitPEFile.pas
    • unitResFile.pas
    • unitResourceDetails.pas
    • unitResourceExaminer.pas
    • unitResourceGraphics.pas
    • unitResourceToolbar.pas
    • unitResourceVersionInfo.pas

unitResourceGraphics.pas references gifimage, so copy GIFImage.pas from ImageTypes100 to the democode/Others/ColinWilson/ directory and add it to the Delphi project.

Then it should be able to compile.

Note

The latest email I received asked how to compile in order to modify the product version of the file rather than the file version.

Note that there file version and product version are stored as both numbers and strings in the resource. SetVersion.exe currently modifies only the file version stored as numbers. The “File version” of an EXE when viewed from the Windows Explorer shows this, but it shows the string representation for “Product version”. In order to change the string version, you need to use

VersionInfoResourceDetails.SetKeyValue('ProductVersion', '1234567');
posted by Jason at 11:36 pm