title: TFS 2010 Issue with tracking Changesets in Builds that are a result of Gated Checkins
body: <p>In order to retrieve the information which Changeset was included in which Build, we use "Label Sidekick" of Team Foundation Sidekicks, where we place the Label of the Build &amp; expect to find the newly built Changeset.</p>
  
  <p>Our development process in TFS 2010 is making use of 'Gated' checkins, so we are faced with the situation that the latest checkins are not presented in Sidekicks (we actually receive the changeset of the <em>previous</em> build). This is explainable, since at the time the labeling takes place, the latest changes have not yet been committed.</p>
  
  <p>The BuildLog does report the associated Changeset correctly.</p>
  
  <p>I 've made several experiments in our Build Process Template but can't seem to get what we need. 
  Placing, for example, the Labeling activity out of the "Run On Agent" scope, lead me to a build that fails at the very start with an "Object reference not set to an instance of an object." (I suppose this is related with fact I had to widen the scope for 'Label' &amp; 'Workspace' variables to get the second part running).<br>
  The 'before' state of the build process template for this attempt is <a href="http://img28.imageshack.us/img28/760/previousstateofbuildtem.png" rel="nofollow">here</a> (this works), the 'after' state ("Object ref not set..") is <a href="http://img862.imageshack.us/img862/7688/newstateofbuildtemplate.png" rel="nofollow">here</a>.</p>
  
  <p>So, to summarize, two different types of input could help me out:</p>
  
  <blockquote>
    <p>How should I change our build process template so that the labeling happens <em>after</em> the Gated checkins have been committed? (-- This would rationalize the display in Sidekicks)</p>
  </blockquote>
  
  <p>or</p>
  
  <blockquote>
    <p>How can I programmatically retrieve the associated Changeset of each Build? (-- This would enable me to write a small app that could obsolete the Sidekicks angle)</p>
  </blockquote>