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
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.