Custom NAnt Tasks: TFSCheckOut and TFSCheckIn

Published 24 December 08 10:50 AM | jacobl 

Here are a few custom NAnt tasks we use in-house for our TFS needs: tfscheckout, tfscheckin, tfsmerge, and a few others. I posted on the topic of Writing Custom NAnt Tasks a while ago, and some of them have been updated. So, if you are using those, make sure you update your build scripts to use the modified schema.

Below is a list of some of the included tasks and how you might use them.

TFSCheckOut

   1:  
   2: <tfscheckout server="tfsServerName"
   3:              ssl="false"
   4:              port="8080"
   5:              projectPath="$/Path/to/Project/In/TFS"
   6:              localPath="C:\path\to\workspace\dir"
   7:              recursionType="Full"
   8:              workspace="nameOfWorkspace"
   9:              deleteWorkspace="false">
  10:   <fileset>
  11:     <include name="C:\Path\to\file\in\workspace"  />
  12:     <include name="C:\Path\to\another\file\in\workspace"  />
  13:   </fileset>
  14: </tfscheckout>

TFSCheckIn

   1: <tfscheckin server="tfsServerName"
   2:          ssl="false"
   3:          port="8080"
   4:          projectPath="$/Path/to/Project/In/TFS"
   5:          localPath="C:\path\to\workspace\dir"
   6:          recursionType="Full"
   7:          comment="NAnt Checkin"
   8:          workspace="nameOfWorkspace"
   9:          deleteWorkspace="false">
  10:   <fileset>
  11:     <include name="C:\Path\to\file\in\workspace\that\is\checked\out" />
  12:     <include name="C:\Path\to\another\file\in\workspace\that\is\checked\out" />
  13:   </fileset>
  14: </tfscheckin>

TFSMerge

   1: <tfsmerge server="atalatfs"
   2:          ssl="false"
   3:          port="8080"
   4:          projectPath="${ProjectPath}"
   5:          localPath="${Atala::GetCWD()}"
   6:          comment="NAnt Library Merge"
   7:          workspace="${Server}"
   8:          deleteWorkspace="false"
   9:          force="false">
  10:   <merges>
  11:     <merge from="$/Path/to/file/in/tfs" to="$/Path/to/branched/file" />
  12:     <merge from="$/Path/to/another/file/in/tfs" to="$/Path/to/this/files/branched/copy" />
  13:   </merges>
  14: </tfsmerge>

Also Included

Other tasks that are included in this assembly are TFSGet, AddXMLElement, RemoveXMLElements, RemoveTFSBindings, and LaunchDebugger.

Download

Comments

No Comments
Anonymous comments are disabled