We want to be able to control the version of each of our releases. This was being done by leaving the Assembly Info to 1.0.*
Soon it was time to release and we needed greater control of the version number. On a previous project we had a Version.xml file that was stored in source control. This was “Got” on each build, read in, +1’d, updated and checked back in. It also updated a comment (RegEx replacement) in the AssemblyInfo.cs file with the new version number. We also share the Version.cs file by adding it as a link to each project (the dropdown on the Add button when adding an existing file to project)
The drawbacks to this were that you had to prefix the comment when you checked in with “*** NO_CI” and you had to manage the workspaces to get the latest. It was also to set the build number as you had to perform a check in.
This time, there was a check-in policy that prevented checking the version file back in. Instead of solving this (it looked like its was going to be a custom task) we have moved to a version file next to the Drop folder of the build server (on a network share).
Now we can have different version files on the network share and the release manager can update the version numbers as required. The revision number is still incremented by the msbuild scripts. This file is also updated once the build completed with the location of the drop. The last good drop path is used when automatically deploying.
Note we have also had problems with the difference between FileVersion and AssemblyVersion. http://support.microsoft.com/kb/556041
Branching
So that we can support new work and bug fixes, we have used TFS Source control to branch releases.
After you have created a branch, you need to create a new build type. It’s just as quick to compare the previous build type and just update the version number and path. You must then also create a \\projectbuildserver\Public\Versions\Branch_2.1.3.xml file and set the version number up. The project contains information about updating the xml file (note posted).
This means that each branch is under CI with shippable build popping out after each check in.
Note that labels are removed when the builds are removed. So if the retention policy removes them, the label is lost. To stop this, keep all builds (if you have the space) or mark a build as retain indefinitely on the completed builds window.
Once the build is completed, the version.xml file is updated with the location of the build so that a deployment process can always get the latest.
kk. Comments welcome.