Ruminations of J.net idle rants and ramblings of a code monkey

End-to-End Task Debugging

In my previous post, I talked about how to debug a TFS 2008 Build using MSBuild Sidekick. But there’s more to this story … you can also do end-to-end (as in, as part of a complete TF Build) debugging of custom tasks. Regardless of the number of unit tests that you write (and they should be numerous), they don’t always show quirks in the environment that you are working in. They do, however, give you a pretty good idea of whether or not your task will work so don’t think that I’m saying that they aren’t valuable. And, of course, based on the end-to-end debugging and any bugs you may find in there, you’ll write additional unit tests to handle those scenarios.

Back to the matter at hand. It’s actually pretty easy once you have MSBuild Sidekick debugging a Team Build. Add your task into the build and call it in one of the TFBuild extensibility targets (preferably in the target that you are actually likely to use). From there, go back to Visual Studio and attach to the MSBuild Sidekick process (Debug … Attach to Process).

image 

And once you are attached, start debugging the build with Sidekick. You’ll go straight from stepping through your targets and tasks into your code and then back again. Very nice!