If you want to debug an MSBuild script from without Visual Studio, you need to use the /debug command line option.
The trick is that this option is not normally available; you need to set a registry key to enable it.
Enable the MSBuild Debugger Under the HKLMSoftwareMicrosoftMSBuild4.0 key, create a string value called EnableDebugger with a value of “true”.
If you’re on a 64 bit system, you’ll also want to set the same value under the key HKLMSoftwareWow6432NodeMicrosoftMSBuild4.
Read More »