Multi debugging in Visual Studio

Firstly, I couldn’t come up with a “snappy” title for this post, so went with the above. I guess I’m too busy to be even marginally creative!

I have recently been working with a multiple web project solution in Visual Studio. For ages, I’ve been switching between each web project by stopping debugging, setting the other as the start up project, and then starting debugging again. As you can imagine, this makes testing interoperability between the two quite a drag.

One of my colleagues showed me that if you set a specific port for Visual Studio’s development server, you can then start the main project (in the normal fashion), but then also start the second project by right-clicking on it, and selecting “run” from the debug menu.

This was a good step forward for me, as previously I wasn’t sure it was possible to achieve debugging across two projects if there was no direct reference defined. However, being the person I was, I wasn’t quite satisfied with having to start one project, then manually starting the second once it had started. So I had a bit of a dive through the various properties and configuration screens within Visual Studio and discovered a method that allows you to start multiple projects, in a defined order, by simply hitting F5.

To do it, right click on the Solution, and choose properties from the context menu. Once the new window appears, ensure “Common Properties”->”Startup Project” is selected from the list on the left.
Then, on the right side of the screen, select the “Multiple startup projects” option. Finally, change the “Action” cell in the table for each project you want to start up when you begin debugging.
If you need to specify or change the order in which projects are selected, you can select the table row for that project, and using the up/down arrow on the right of the page, move it up and down in the startup order.

solutions-props

Quite a neat trick that could have saved me a good deal of ball ache in the earlier parts of this project!


Leave a Reply