[英]Starting another project in the solution in Debug mode
I am working on two processes that interact with each other via named pipes. 我正在研究通过命名管道相互交互的两个过程。 Process#1 is running in debug mode and it starts Process#2 with
Process.Start("process name")
I want to run this process#2 on debug mode also, using breakpoints. Process#1在调试模式下运行,它以
Process.Start("process name")
启动Process#2,我也想使用断点在调试模式下运行此Process#2。 How can I do this? 我怎样才能做到这一点?
I have tried using "Attach to Process" tool in Visual Studio 2008 but it's not very practical when you are in the development process. 我曾尝试在Visual Studio 2008中使用“附加到流程”工具,但在开发过程中它并不实用。 You need to start Process#2 in order to attach to it.
您需要启动Process#2才能对其进行附加。 I want Process#2 to be started directly in debug mode.
我希望直接在调试模式下启动Process#2。
Put this line in the Main() method of the 2nd project: 将此行放入第二个项目的Main()方法中:
System.Diagnostics.Debugger.Launch();
That brings up the just-in-time debugger prompt as soon as the 2nd process starts running. 一旦第二个进程开始运行,就会弹出即时调试器提示。 You can pick either a new or an existing instance of visual studio to debug it.
您可以选择Visual Studio的新实例或现有实例进行调试。 Use Debug + Step Out to get back into managed code.
使用Debug + Step Out返回到托管代码。
如果对此项目有相同的解决方案,则可以在解决方案属性中使用多个启动(解决方案属性->启动项目)
Go to solution properties in VS. 转到VS中的解决方案属性。 Opt for multiple startup project.
选择多个启动项目。 Unless your requirement insist opening of second app from first, this should work fine.
除非您的要求坚持从一开始就打开第二个应用程序,否则这应该可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.