views:

324

answers:

2

I'm trying to debug the MSBuild Customtask, that I have just created, but for some reason it never stops at the breakpoint. I've even tried this:

    public override bool Execute()
    {
        System.Diagnostics.Debugger.Break();

And added a break point on that line... I even eliminated all the other code in the method and that didn't change anything.

Is there anything special required to be able to debug the creation of custom tasks for MSBuild ?

+2  A: 

It's a bit of a hack, but you could always just put this line of code wherever it is that you want to start debugging:

System.Diagnostics.Debugger.Launch();

When you invoke it, the CLR will launch a dialog asking you what debugger you want to attach.

Joel Martinez
That worked, but I don'o understand why Break() didn't ... thanks, atleast I can debug
CheGueVerra
+2  A: 

This is what I do... In the Project Properties dialog on the Debug Tab Select "Start an External App" - put C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe in the box..

Then in the command line parms, put your arguments /Target:Whatever test.proj

Put a code stop in your custom task and start the app..

Nice suggestion ... I'll try it out later, thx
CheGueVerra