How to keep track of the SCM revision in the build versions automatically?
I want to look at a production binary and know which revision in the SCM开发者_Python百科 corresponds to that build. How it is possible? Can I accomplish that in Visual Studio using VSS?
As Dave has answered: " You could put $VERSION$ or something alike in a header file to have it accessible by the code. It should work with any svn client. Here's some more info on it: http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html "
If you're talking of any build created by any developer, then the answer is you can't, because even if you know the base revision the binary was created from, you don't know whether the developer had local modifications.
If you're talking about released software: Your binaries should have a version number attached and you should find a label/tag/branch with that version number in your repository. Of course, there's ways to automate this (keyword expansion come to mind, or an automated build script getting the version from the tag name), but in the end it all boils down to these three:
- automated builds on a dedicated machine (preferably some GUI that you just throw a tag/label at)
- version numbers in binaries
- tags/labels/branches for released versions in the SCM.
精彩评论