如何调试从另一个进程启动,在VS2010一个C#.NET应用程序 [英] How to debug a C# .Net application in VS2010 that is started from another process

查看:203
本文介绍了如何调试从另一个进程启动,在VS2010一个C#.NET应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用C#和PDF打印机一个.NET GUI应用程序。 PDF格式的打印机有一个字段,您可以设置一个命令来启动外部应用程序。在这种情况下,我可以用这个打印机打印文档和打印机开始我的exe文件的文件路径来生成的PDF作为参数。当它从打印机开始我如何调试我的应用程序。在VS2010我可以设置调试的相关信息的命令行参数,这工作正常。但是,如果应用程序是从打印机启动应用程序不能正常工作。因此,我希望当它从打印机开始调试应用程序。我怎样才能做到这一点?是否有任何参数来启动在调试模式还是这样呢?

I have a .net GUI application written in c# and a pdf printer. The pdf printer has a field where you can set a command to start an external application. In this case i can print a document with this printer and the printer starts my exe with the filepath to the generated pdf as argument. How can i debug my application when it is started from printer. In VS2010 i can set debug infos for command line arguments, this works fine. But if the application is started from printer the application doesn't work fine. Therefore i want to debug my application when it is started from printer. How can i do this? Is there any parameter to start an exe in debug mode or something like this?

推荐答案

您可以附加到一个进程时,它会开始使用一个小的注册表调整。

You can attach to a process when it starts using a small registry tweak.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options

创建一个可执行文件的名字一个新的关键,因为它会出现在任务管理器中,例如程序myapp.exe 。在此,创建一个名为新字符串值调试键,将其设置为 vsjitdebugger.exe

Create a new key with the name of the executable as it will appear in task manager e.g myapp.exe. Under this, create a new string value called debugger and set it to vsjitdebugger.exe

现在,当EXE被触发,会出现一个窗口询问哪个调试器附加到。

Now, when the exe is triggered, a window will appear asking which debugger to attach to.

这篇关于如何调试从另一个进程启动,在VS2010一个C#.NET应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆