Subversion version string in binary

Technical Note 57192






2/8/2018 6:14 AM


I want a version string in my executable. I am using Subversion.

Possible solution

Use the Subversion program svnversion to produce version strings.

  • Set a pre-build action to call an appropriate script.
  • Create a script creating a C source file with a version string.
  • Include the created C source in your project.
  • Do not include the created C source in your version archive.
  • Optionally, use the version string in your code. If so, suggest to create and use a headerfile as done in the example code.
  • Optionally, add a post-build action to remove the created C source.

Download Example (TN57192).zip for more details.

You may want to look at the screenshots in the example file first.


Has been tested

  • with IAR Embedded Workbench for ARM version 6.50.3.
  • with IAR Embedded Workbench for AVR version 6.20.2.
  • on Microsoft Windows 7 64-bit.
  • with path including blanks.
  • with path on another drive letter.
  • with path on a UNC share (e.g.,\\server\share\path).

Set Tools > Options > Messages > Show build messages > 'All' to get messages from bat file in Build Log.


All product names are trademarks or registered trademarks of their respective owners.

We do no longer support Internet Explorer. To get the best experience of, we recommend upgrading to a modern browser such as Chrome or Edge.