DCSIMG
Debugging Team Build – Now you can !!! - Baruch Frei
Sign in | Join | Help

Debugging Team Build – Now you can !!!

In the last post I wrote about the new features in the new coming version of the

TFS 2010. In the next posts I will try to give a closer look on every feature.

TFS 2008 Build script editing

In TFS 2008 the build script was written in xml based on Msbuild scripts.

Which means that editing the script was pretty ugly and annoying method.

This scripts defines the targets and tasks to run in the build but the schema

was never updated to recognize all the new targets and tasks so you didn’t

really got help by the Intellisense. Beside that, when writing custom tasks, there

is no way that the script will recognize your task and help you call it with the

right parameters and syntax.

And the worst thing is that there is no way to debug it on runtime. The

only way to debug it is by inserting custom messages in the log and review it

afterwards. Ugly!

TFS 2010 Build script editing

In TFS 2010 the build script is written in a new modern language: Workflow 4.0.

This means that the language is fully supported and much easy to edit and

maintain as writing any application in Workflow. All steps (aka targets) are known

and recognized by the Intellisense. Every custom activity you write (aka tasks) is

fully recognized - no more guessing for the right syntax.

(BTW Aaron wrote a great post on how to write custom activity.)

And the most exiting thing is that now you can debug it at runtime

Here is how you do it:

  1. open the process template project file

    image

  2. right click where you want in the flow and add break point
  3. click Debug menu –> Attach to process
  4. find the TFSBuildServiceHost and attach to it

    image

    (don’t forget to mark the show process from all user in all sessions)

  5. run the build and wait for the break point to be hit
  6. now you can debug it as any application

image

image

Enjoy !

Comments List

# re: Debugging Team Build – Now you can !!!

Published at Tuesday, July 14, 2009 7:24 PM by Matt Ruwe  

This is so freaking cool!  No more <Message> tags!Thanks for the post!

# re: Debugging Team Build – Now you can !!!

Published at Wednesday, July 07, 2010 6:30 PM by d  

I am not able to get this working. First off, my machine does not have a  TFSBuildServiceHost.exe running. So I tried to do this on my team foundation build server and I found the process. Great so I open the workingflow script, set my breakpoint, attach the process. Then what? The article says "Run the build." How? There is no run button...

So instead I went to my team explorer and right clicked the build and run it, but the breakpoint does not get hit. What am I missing?

If I look on the breakpoint window I see my breakpoint but it has a warning symbol that says "this breakpoint will not currently be hit. No symbols have been loaded for this document."

Could this have something to do with the fact that I am using the method where I have an "ActivityPack" project and I have branched the build script into a directory in this project. I have pointed the team explorer to this branched build script.

# re: Debugging Team Build – Now you can !!!

Published at Thursday, July 08, 2010 10:33 AM by Baruch  

Hi

1.First of all TFSBuildServiceHost runs on the machine where team build is installed .you can ope your project on that machine and attach to process or use Remote Debugger on build machine.

2.Run the build - of course from team explorer .

3.If you pointed the build in process tab to use your updated xaml thats good enough.

4.try to add activity to Controller section in the Workflow. I found out that if you add it to Agent scope it's not always get hit.

Good Luck

Baruch

# re: Debugging Team Build – Now you can !!!

Published at Thursday, July 29, 2010 11:19 PM by Ken  

I'm having the same trouble as your last commenter, and I'm new to both TFS and Workflow, so I don't understand your #4 tip in the last comment.

You said "Try to add activity to Controller section in the Workflow." Can you explain how to do this?

Thanks,

Ken

# re: Debugging Team Build – Now you can !!!

Published at Thursday, July 29, 2010 11:20 PM by Ken  

(Sorry... I forgot to enter my email address, so I could get notified about any responses to my question. :)

# re: Debugging Team Build – Now you can !!!

Published at Wednesday, November 03, 2010 11:20 AM by any  

hi, My breakpoint just doesn't get hit wherever I put it in the workflow. Can u advice me on this?

# re: Debugging Team Build – Now you can !!!

Published at Wednesday, November 03, 2010 12:35 PM by BaruchF  

Hi,did you try all my advices in the second comment ?

Specially the one about trying to put your breakpoint in the controller section.

I found that in agent section your breakpoint not always get hit.

Baruch

# TFS 2010 Debugging not stopping at Breakpoints - Question Lounge

Published at Friday, December 31, 2010 11:19 AM by TFS 2010 Debugging not stopping at Breakpoints - Question Lounge  

Pingback from  TFS 2010 Debugging not stopping at Breakpoints - Question Lounge

# re: Debugging Team Build – Now you can !!!

Published at Friday, February 25, 2011 1:23 AM by Paul  

Why is it that breakpoints are not hit within the "Run On Agent" AgentScope activity? This is very concerning.

# Debugging Team Foundation Server 2010 Build Workflow | .Net Technical Blog

Published at Monday, May 23, 2011 10:07 PM by Debugging Team Foundation Server 2010 Build Workflow | .Net Technical Blog  

Pingback from  Debugging Team Foundation Server 2010 Build Workflow | .Net Technical Blog

# re: Debugging Team Build – Now you can !!!

Published at Tuesday, September 20, 2011 11:10 PM by Kurt  

This is example is useless without further clarification.  I've tried it also on my TFS build machine and it doesn't break at the breakpoints.

Leave a Comment

(required) 
(
required
)
 
(optional)
(required) 

Enter the numbers above: