如何调试从另一个进程启动的Visual Studio 2010中的C#.NET应用程序 [英] How to debug a C# .NET application in Visual Studio 2010 that is started from another process
问题描述
在这种情况下,我可以使用此打印机打印文档,打印机启动我的EXE文件以文件路径生成的PDF文件作为参数。在打印机启动时,如何调试应用程序?
在Visual Studio 2010中,我可以为命令行参数设置调试信息,这样可以正常工作。但如果应用程序从打印机启动,应用程序不能正常工作。因此,我想从打印机启动时调试我的应用程序。我该怎么做?有没有参数可以在调试模式下启动一个EXE文件,或者是这样的?
开始使用小的注册表调整。
转到
HKEY_LOCAL_MACHINE\\ \\ SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image文件执行选项
创建一个新的键,其可执行文件的名称将显示在任务管理器中,例如 myapp.exe
。在此下,创建一个名为 debugger
的新字符串值,并将其设置为 vsjitdebugger.exe
。
现在,当EXE文件被触发时,会出现一个窗口,询问要附加哪个调试器。
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 file with the filepath to the generated PDF file as argument. How can I debug my application when it is started from the printer?
In Visual Studio 2010, I can set debug information for command line arguments, and this works fine. But if the application is started from the 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 a parameter to start an EXE file in debug mode or something like this?
You can attach to a process when it starts using a small registry tweak.
Go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
Create a new key with the name of the executable as it will appear in Task Manager, for example, myapp.exe
. Under this, create a new string value called debugger
and set it to vsjitdebugger.exe
.
Now, when the EXE file is triggered, a window will appear asking which debugger to attach to.
这篇关于如何调试从另一个进程启动的Visual Studio 2010中的C#.NET应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!