简体   繁体   English

在调试模式下在解决方案中启动另一个项目

[英]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.

相关问题 如何在调试模式下在解决方案中启动另一个项目 - How to start another project in the solution in Debug mode 解决方案中一个项目的发布模式,而其他所有项目的发布模式 - Release mode for one project in solution, but Debug mode for all others 在Windows Phone解决方案中在主项目中启动另一个项目 - Starting another project within main project in a solution for windows phone 在本地调试模式下启动Azure项目时,我得到“对象引用未设置为对象实例” - When starting my Azure project in local debug mode, I get “Object reference not set to instance of an object” Visual Studio,在同一解决方案文件中调用另一个项目的Debug项目 - Visual Studio, Debug project that calls another project within the same solution file 通过C#代码在同一解决方案中对另一个项目执行“项目>调试>启动新实例” - Doing “project>Debug>Start new instance” of an another project in the same solution through c# code C#如何在调试模式下从另一个clickonce winforms项目启动clickonce winforms项目 - C# How to launch a clickonce winforms project from another clickonce winforms project in debug mode 无法在MonoDevelop中调试多项目解决方案 - Cannot debug a multiple-project solution in MonoDevelop 同一解决方案中的现有项目,但无法调试 - existing project in the same solution but can't debug it 来自另一个解决方案的参考项目 - reference project from another solution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM