title: TeamCity to read and update version number from version file
body: <p>We are using TeamCity as a CI server and we've been thinking how to implement a method for versioning our releases that is safe (i.e. minimal opportunity for human error) but also that requires the least effort possible. So far the following seems the most logical:</p>
  
  <ol>
  <li>Create a version file (or use assemblyinfo.cs). The version information would be in the format .... This file will be checked into my VCS.</li>
  <li>Run a TeamCity build</li>
  <li>TeamCity reads the version file from step 1, picks out each individual numbers and sets corresponding TeamCity build parameters (so I can use them later for things such as creating nuget packages and labelling)</li>
  <li>TeamCity auto increments the final 'build count' value.</li>
  <li>TeamCity saves the new version information back to the version file (with the updated 'build count')</li>
  <li>TeamCity then runs through the rest of my build steps, building files, running unit tests, setting the correct assembly versions etc.</li>
  <li>TeamCity finally checks the file back into VCS</li>
  </ol>
  
  <p>We believe the benefit of doing things this way is should we need to do a fix of an old release then the version number will be correct and TeamCity can simply work with the old version file, and incrementing the build count as usual. This does make the assumption that we are updating our major/minor/patch versions correctly. This will hopefully work nicely with the soon to be released feature of TeamCity 7.1 that lets you choose which branch to build via the custom build dialog.</p>
  
  <p>From what I've already read so far these sort of operations should be possible in TeamCity but we're looking for the easiest root to get this fixed as we're only a two-man outfit and we can't afford to invest large amounts of time into becoming experts at Nant or powershell only to find it might not do what we want.</p>
  
  <p>So I guess to sum up my questions are as follows:</p>
  
  <ol>
  <li>Is what I am proposing possible?</li>
  <li>If yes then what is the best tool to use given my limited experience of Nant, powershell etc (i.e. which is the quickest to learn for someone whose command line and script experience extends as far as simple DOS operations and a bit of VBScript) </li>
  </ol>
  
  <p>Any help is greatly appreciated.</p>