Galin Iliev's blog

Software Architecture & Development

MSBuild - Debug a msbuild script–enters the debug switch

It would be great if it was possible to debug msbuild script. Step in, step out, see properties and values… Seems like there is a way to do it via VS2010 although unsupported. What needs to be done is:

  1. Ensure you debug “Just my code”:
  2. Enable undocumented "/debug" switch on MSBuild.exe by adding registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\4.0 key to have debuggerenabled=true. Execute this in command prompt:
    reg add HKLM\SOFTWARE\Microsoft\MSBuild\4.0 /v DebuggerEnabled /t REG_SZ /d true
  3. Check /debug switch:
    MSBuild /?
  4. Run your build with /debug switch:
    MSBuild MyCode.proj /debug
  5. Once you get standard JIT debugging prompt make sure you select "Manually choose the debugging engines".
  6. Select Managed mode only:
  7. Enjoy

 

Thanks to Visual Studio blog and Dan Smile

Also John Robins has a way to do it but I didn’t try it…

Loading