简体   繁体   English

Visual Studio:同时调试多个项目?

[英]Visual Studio: debug multiple projects at the same time?

Is it possible to debug multiple projects at the same time in Visual Studio? 是否可以在Visual Studio中同时调试多个项目?

I know you can select multiple startup projects from the solutions properties, but how are the breakpoints handled? 我知道您可以从解决方案属性中选择多个启动项目,但是如何处理断点?

If two projects use the same class (two different instances of it), and I am stopped with a breakpoint in it, will it only block one program or both? 如果两个项目使用相同的类(它的两个不同实例),而我在其中有一个断点而停下来,那么它只会阻塞一个程序还是同时阻塞两个程序? How can I know which executable is hitting the breakpoint? 我怎么知道哪个可执行文件达到断点? I'm a bit confused. 我有点困惑。

Yes, it is possible. 对的,这是可能的。 You can set multiple startup projects in your solution (right-click solution, go to Set Startup Projects , choose Multiple startup projects ), and specify the action for each project contained in the solution ( None , Start , Start without debugging ). 您可以在解决方案中设置多个启动项目(右键单击解决方案,转到“ 设置启动项目” ,选择“ 多个启动项目” ),然后为解决方案中包含的每个项目指定操作( 启动无需调试即可启动 )。 If you have multiple projects set to Start , the debugger will attach to each one as it launches. 如果将多个项目设置为Start ,则调试器将在启动时附加到每个项目。

When you hit a breakpoint, you can see which process you're in using the Debug Location toolbar (you may have to show it; some profiles hide this by default). 当您遇到断点时,您可以使用“ 调试位置”工具栏查看正在使用的进程(您可能必须显示它;某些配置文件默认将其隐藏)。 It will show which process you're currently looking at, which thread you're on, and which stack frame you're in: 它将显示您当前正在查看的进程,正在使用的线程以及处于的堆栈框架:

调试位置工具栏

I believe the default behavior is that when one process breaks, the debugger will break all of them. 我相信默认行为是,当一个进程中断时,调试器将中断所有中断。 This way you can check the state of any attached process when you hit a single breakpoint. 这样,当您遇到单个断点时,您可以检查任何附加进程的状态。

No. You can debug an EXE file and step into a debug version of a linked DLL file, if you're careful about making sure the EXE file "sees" the same DLL file as the debugger, but you can't debug two EXE files at the same time. 否。如果您要确保EXE文件与调试器“看到”相同的DLL文件,但可以谨慎操作,则可以调试EXE文件并进入链接DLL文件的调试版本,但不能调试两个EXE。文件在同一时间。 At least as far as I'm aware. 至少据我所知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM