I am using CCNET on a sample project with SVN as my source control. CCNET is configured to create a build on every check in. CCNET uses MSBuild to build the source code.
I would like to use the latest revision number to generate AssemblyInfo.cs
while compiling.
How can I retrieve the latest revision from subversion and use the value in CCNET?
Edit: I'm not using NAnt - only MSBuild.
I am currently "manually" doing it through a prebuild-exec Task, using my cmdnetsvnrev tool, but if someone knows a better ccnet-integrated way of doing it, i'd be happy to hear :-)
Found the above technique to auto-gen AssemblyInfo.cs using MSBuild. Will post sample shortly.
Be careful. The structure used for build numbers is only a short so you have a ceiling on how high your revision can go.
In our case, we've already exceeded the limit.
If you attempt to put in the build number 99.99.99.599999, the file version property will actually come out as 99.99.99.10175.
I have written a NAnt build file that handles parsing SVN information and creating properties. I then use those property values for a variety of build tasks, including setting the label on the build. I use this target combined with the SVN Revision Labeller mentioned by lubos hasko with great results.
If you prefer doing it on the
MSBuild
side over theCCNet
config, looks like theMSBuild
Community Tasks extension'sSvnVersion
task might do the trick.Based on skolimas solution I updated the NAnt script to also update the AssemblyFileVersion. Thanks to skolima for the code!