如何调试从另一个进程启动的Visual Studio 2010中的C#.NET应用程序 [英] How to debug a C# .NET application in Visual Studio 2010 that is started from another process

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

问题描述

我有一个用C#编写的.NET GUI应用程序和一个PDF打印机。 PDF打印机有一个字段,您可以在其中设置启动外部应用程序的命令。



在这种情况下,我可以使用此打印机打印文档,打印机启动我的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屋!

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