title: Increment version during publishing and check in to Team Foundation Server (TFS)
body: <p>I am at present setting up my <a href="http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework" rel="nofollow">ASP.NET MVC</a> 4 web application with publish profiles and the associated publishing features. My <a href="http://en.wikipedia.org/wiki/Continuous_integration" rel="nofollow">continuous integration</a> (CI) environment is <a href="http://en.wikipedia.org/wiki/Team_Foundation_Server" rel="nofollow">Team Foundation Server</a> (TFS) build 2010 and TFS for source control.</p>
  
  <p>I have a number of requirements that I would like to achieve with this. Firstly, each time I create the publish package for release, I would like the build number to be incremented and revision number reset to 0 in my version file. I currently have one version file that contains the version number of <code>Major.Minor.Build.Revision</code>. So I would like the creation of the publishing package to do such. Is this possible and if so how is it achieved? Note as this increments the version file, as part of this process I would like this checked in to source control.</p>
  
  <p>My second question is that each time a developer checks in to the TFS build server, the revision number will get incremented or at least changed to a new value. I had hoped to update my build template to achieve this, but unfortunately due to restrictions on my build server I can not incorporate any custom activities on it. So I am looking to perform this task with <a href="http://en.wikipedia.org/wiki/MSBuild" rel="nofollow">MSBuild</a>. Is it possible to achieve what I outlined here with MSBuild and if so, could I get an explanation please?</p>