A Minimal TFSBuild.Proj File

A fair number of people seem to want to use Team Build to kick off their own pre-existing build scripts that have nothing in common with the process defined in Microsoft.TeamFoundation.Build.targets.  While we don't typically encourage this, enough people want to do it that I figured I should finally post an example.  So - the minimal tfsbuild.proj file that will kick off your custom build script would look something like this:

 <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="https://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <Target Name="EndToEndIteration">
    <Exec Command="SomeScript.cmd" />
  </Target>
</Project>

Of course, most of the Team Build goodness comes from executing the standard targets while having our logger attached, so this approach will not generate a lot of information - no build steps will show up in the build report within VS, it won't keep track of errors/warnings, no data will be pushed to the warehouse (and thus reporting across builds will not work), and so forth.

If you can abstract your custom build script down to the compilation portion, and let the standard build process handle the Get, the Label, etc. you'll be in better shape.  To do this, just override the BeforeCompile target and execute your custom script there, leaving the rest of the TfsBuild.proj file (especially the import of Microsoft.TeamFoundation.Build.targets) alone.

Comments

  • Anonymous
    July 28, 2008
    PingBack from http://blog.a-foton.ru/2008/07/a-minimal-tfsbuildproj-file/
  • Anonymous
    August 01, 2008
    The US ISV Developer Evangelism Team on Team Foundation Server Works with Other Tools Eugene Zakehareyev...
  • Anonymous
    October 27, 2008
    Aaron - Is there a way that i can use the TFS logger to propagate the error message if there's any failure in the custom build step?will tfs publish the error messages from my cmd file or nant file - as in assuming it just as an output from Exec command?