How To Debug MSBuild Files in VS2010

A few weeks back, Craig Bernston posted a link about how MSBuild files can be debugged! I wasn't sure if this was possible so I followed the guide to get it going. I hit a few snags with trying to get msbuild working (or so I thought) but it was down to x86 and x64 versions.

It has taken me a while to post this so that I can actually try this out and make sure that it works – i can’t be responsible for passing around a link that causes harm ;) The guide is here - http://stack72.me/gfGTse

The start of the guide talks about how to add the registry information to allow this to happen. Please note the following caveat to that information:

If you are on a x64 system – then you will usually start the cmd.exe in x64 version. Therefore when you are actually starting the msbuild version you have just edited it will usually be on the following path

C:\Windows\Microsoft.NET\Framework64\v4.0.30319

so when you are trying to debug a msbuild file open a command prompt and run a command similar to as follows:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /t:rebuild /debug <project or solution path here>

This will then allow you to proceed and debug the file as necessary. This has brought me a lot of happiness as it has helped me create killer build scripts.

Happy building!

Comments (3) -

Craig Berntson
Craig Berntson
2/19/2011 1:31:41 AM #

Great to hear you have it working. Thanks for the plug.

stack72
stack72
2/19/2011 1:44:35 AM #

craig - it has been a fantastic addition to my toolbelt Smile

Gary Park
Gary Park
2/20/2011 11:35:19 AM #

Noice!

I know a few guys at work who will be very interested in this!

Pingbacks and trackbacks (1)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Me

 

Web Developer. My most used framework is C# with MVC but use Webforms on occasion. Im an advocate of clean, maintainable code and am very passionate for what I do. Absolutely obsessed with Continuous Integration and how it should be used in every day development scenarios. Trying to move towards a system of Continuous Deployment
Follow Me on Twitter

Jetbrains Academy Member

 

MVB Blogger

 

Friends Of Redgate

Month List