다음을 통해 공유


Getting the Modified Files for a Team Build Build in Orcas

In a post back in January, 2007 I discussed a method for figuring out which files had changed since the previous Team Build build.  In a March, 2007 post I mentioned that a new feature in Orcas makes this process quite a bit easier...  Well - here are the details.

We added a property to our MSBuild logic called GetPopulateOutput - if you set this property to true, the Get task populates three output item groups: Gets, Replaces, and Deletes. These will contain, respectively, the newly retrieved files (these will be adds if you are doing an incremental get), the replaced files (these will be the edits), and the deleted files (the deletes, obviously). So - to take advantage of this feature, you would want to do something like the following in your TfsBuild.proj file:

   <PropertyGroup>
    <!-- Do an incremental get but a clean build. -->
    <IncrementalGet>true</IncrementalGet>
    <!-- Instruct the Get task to populate its output item groups. -->
    <GetPopulateOutput>true</GetPopulateOutput>
  </PropertyGroup>

  <Target Name="AfterGet">
    <!-- Do something with the Get task outputs in a target that comes *after* the CoreGet target. -->
    <Message Text="Gets: @(Gets), Replaces: @(Replaces), Deletes: @(Deletes)" />
  </Target>

For each of these item groups, the identity of each item will be the TargetLocalItem (the local path to the item), unless this is null (e.g. for a delete) in which case it will be the SourceLocalItem (the old local path to the item). Each item will also include the following metadata (from the corresponding GettingEventArgs ):

  • ChangeType
  • DeletionId
  • ItemId
  • ItemType
  • Version
  • ServerItem (if non-null)
  • SourceLocalItem (if non-null)

This is one of my favorite little new features - it's a good example of doing just a teeny bit of work on our end to solve what would otherwise be an extremely difficult problem for customers.  I hope some Team Build users find it to be useful!

Comments

  • Anonymous
    July 11, 2007
    Aaron Hallberg on Getting The Modified Files For a Team Build In Orcas. Brian Harry on Cool tool for...
  • Anonymous
    September 14, 2008
    How to get only the changed source code during the Team Build