I’ve had trouble trying to figure out a way to grab the Subversion revision number in order to populate it into the the auto-generated CommonAssemblyInfo.cs file.
major.minor[.build[.revision]]
Google got me Bryant’s post that linked to Jonathan Malek’s post. Which didn’t help at all because he already migrated his blog to WordPress and the link couldn’t be found. The next link I found worth was Dan Hounshell’s post on the topic. Guess who it refers to? Jonathan’s (now invisible) post.
So finally, I put a few things together and I came up with an almost-done solution, YAY!
<property name=”svnrevisiontortoise” value=”nothing” />
<if test=”${directory::exists(‘.svn’)}”>
<loadfile file=”.svn\all-wcprops” property=”svnrevisiontortoise” failonerror=”false” />
<regex pattern=”ver\/(?’svnrevision’\w+)\/” input=”${svnrevisiontortoise}” failonerror=”false” />
</if>
<echo message=”Using Subversion revision number: ${svnrevision}” />
The only stipulation for this is you HAVE to do an update on the repository before calling running this. I tried running a command, but I don’t have Subversion installed on the machine, so it doesn’t recognize it. Plus, I don’t want to add that dependency. Maybe I can throw it in a bin folder or something as a reference.
Now that I have .revision automatically generated, I’ll need to figure out a simple way to both tag and generate the build number.
Hey Tom,
Here’s the article you were looking for:
http://web.archive.org/web/20070830084056/http://www.jonathanmalek.com/blog/SubversionRevisionNumbersAndNAnt.aspx
Basically uses svn log instead.
-Abhi