

Attaching at the first JIT prompt, I can see I am starting in the. Everything will work much the same as before, but you’ll get a new JIT prompt as each child process starts to do its work, and you’ll have to use a new instance of Visual Studio for each one of them.įor example, I’m building a solution here, using the. That environment variable is equivalent to the /debug switch, but unlike the switch it will get propagated to any child processes.įrom this command window now start msbuild.exe with the /debug switch as usual. Then in a command window set an environment variable MSBUILDDEBUGGING=1. To get this to work, first terminate any msbuild.exe processes that are still alive. The /debug switch doesn’t propagate to them. If however for some reason you do need to debug a multiprocessor build, it’s possible.Īs you probably know, MSBuild launches child processes to build more than one project at once, and they persist for a while to be ready for another build. What’s more, debugging slows down the build so much that it may not help you diagnose a timing problem anyway. When you’re debugging your build process or tasks, it’s much easier to follow if only one project is building at a time, and you’ll probably do it that way whenever you can. Now do the usual debugging procedure, but this time launch msbuild.exe against this sln.metaproj file instead of the original solution file. This is essentially the solution file translated into MSBuild-format. Next to the solution file, you should see a file with the extension “.sln.metaproj”.

Then do a build of the solution in the regular way: if you want, you can cancel it after it starts building projects. First, set an environment variable MSBUILDEMITSOLUTION=1. MoseDocumentsvisual studio 2010ProjectsWindowsFormsApplication1WindowsFormsApplication1.csproj (2,1) : MSB0001: Internal MSBuild Error: Mismatched leave was C:UsersdanmoseDoĬumentsvisual studio expected C:Usersdan If you do, you may get an error that looks like this: You well might want to start with a solution file instead. In the previous example, I launched msbuild.exe against a project file. Scenario 3: Debug a Solution file on the command line Note that this blog is rather narrow, so some of the screenshots may be hard to see – you can click on them to see the full size version. In this final post, I’ll mention some other variations.

In my last two posts ( here and here) I showed how to enable the unsupported MSBuild debugger to debug a build started on the command line with MSBuild.exe.
