I have a solution, mostly C#, but with a few VC++ projects, that is pushed through our standard release process (perl and bash scripts on Unix boxes). Currently the initiative is to validate DLL and EXE versions as they pass through the process. All the versioning is set so that File Version is of the format $Id: $
(between the colon and the second dollar should be a git commit hash), and the Product Version is of the format $Hudson Build: $
(between the colon and the second dollar should be a string representing the hudson build details).
Currently this system works extremely well for the C# projects because this version information is stored as plain strings within the compiled code (you can literally use the unix strings
command and see the version information); the problem is that the VC++ projects do not expose this information as strings (I have used a windows system to verify that the version information is correctly being set), so I'm not sure how to extract the version on a unix system. Any suggestions for either
The version information for natively compiled code on Windows is stored in UTF-16, ie wide strings, in the binary. You can still use the strings
command, but you need to tell it to look for wide strings before it'll find them, using the -e l
option.
For example, on my system, RMB > Properties on C:\Windows\notepad.exe gives the file version as 5.1.2600.5512 (xpsp.080413-2105)
. I copied it to a Linux box, and as you say, strings
doesn't find it with the default flags
$ strings notepad.exe | grep xpsp
$
but if you set the encoding it comes out fine:
$ strings -e l notepad.exe | grep xpsp
5.1.2600.5512 (xpsp.080413-2105)