Search code examples
delphidelphi-2010

How can I automatically give an .exe a unique name at compile time?


I want the exe name of an application given 'ProgramExeName + version number' at compilation time (exemple: Filename18190.exe, Filename18191.exe...) - so the exe name is never the same. Considering i have the version number put in a str variable, how to automatically append this number to the exe name currently built? Tx

(Note: i want the renaming be done at compilation time, not manipulated after)


Solution

  • There are several directives to manipulate the filename of output binary {$EXT string}, {$LIBPREFIX 'string'}, {$LIBSUFFIX 'string'}, {$LIBVERSION 'string'} (btw, compiler have nothing with with forming output binary, this done by linker). Neither of them is dynamic, so you HAVE to write desired values right before building your project (good job for OpenToolAPI wizard in the IDE).

    The other possibility is post-build activity which extracts version number (for example: VERSION_INFO) from PE binary and renames the file accordingly