如何启动另一个项目在调试模式下的解决方案解决方案、项目、模式下

2023-09-03 08:13:47 作者:淡澤 m1ss

我有它获取通过启动一个可执行的一些动态参数的WCF主机应用程序。

I've got a WCF host application which gets started by an executable with some dynamic parameters.

现在我想将这个应用程序进行调试,但因为它得到了其他工具开始VS.NET将不会加载它在调试模式。

Now I want to debug the this application but since it's getting started by the other tool VS.NET won't load it in debug mode.

是否有可能写一些DEBUG只有code,迫使它在调试模式下执行该过程,这样它会击中了破发点。

Is it possible to write some DEBUG only code to force it execute this process in DEBUG mode so it'll hit the break points.

目前它的使用的Process.Start()启动主机应用程序。

Currently it's using Process.Start() to start the host application.

它每次都附加到调试器是不是一种选择,我正在寻找一个更实际的解决方案。的

推荐答案

尝试在你的WCF应用程序中添加这一行:

Try adding this line in your WCF app:

System.Diagnostics.Debugger.Launch();

如果应用程序没有调试器下运行,你会得到一个窗口,询问您是否要调试应用程序。

If the app is not running under the debugger, you'll get a window asking if you want to debug the application.