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="http://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.