Ramblings

Delphi Programming Observations

Friday, May 8, 2009

Program To Set Delphi Resource Version Info from commandline

With Delphi’s decision to move to using MSBuild, building Delphi projects from the commandline became a lot easier, but it lacks a way to set the Version Info on the resultant EXE.

Using the code from the XN Resource Editor, it was pretty easy to write a commandline program to change the Version Info stored in a Delphi Resource file, SetVersion.exe. The source code for XN Resource Editor is available at http://www.wilsonc.demon.co.uk/delphi.htm. I found one little problem with the Delphi 2009 version, the RES files were being corrupted after running the SetVersion.exe program, but simply changing a Char and PChar to Byte and PByte fixed it.

Calling the program before calling MSBuild (or DCC32 if you don’t use the latest Delphi) will allow you to set the Version Info, which will be compiled into the EXE.

See the github repository for the source code (SetVersion/ directory). The code only compiles with Delphi2009 (I tried with Delphi 2006 and it failed), but I think it should only take getting the correct version of the XN Resource Editor’s source code files at http://www.wilsonc.demon.co.uk/delphi.htm and dropping them into Others/ColinWilson/.

posted by Jason at 11:49 pm  

One Response to “Program To Set Delphi Resource Version Info from commandline”

  1. [...] first version of the SetVersion.exe tool to update the Version Information of a Delphi executable allowed you to set the version info [...]