如何在visual studio / internet explorer中调试C#BHO项目 [英] How to debug C# BHO project in visual studio/internet explorer

查看:510
本文介绍了如何在visual studio / internet explorer中调试C#BHO项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用visual studio 2010在C#中创建IE扩展。如何在Internet Explorer中运行时调试扩展?

I'm creating an IE extension in C# using visual studio 2010. How do I go about debugging the extension whilst running it in Internet Explorer?

推荐答案

Project + Properties,Debug选项卡。选择启动外部程序,将其设置为c:\ program Files \ internetnet explorer \ xxxplore.exe。您可能希望将命令行参数设置为运行BHO的HTML文件的路径。

Project + Properties, Debug tab. Select "Start external program", set it to c:\program files\internet explorer\iexplore.exe. You probably want to set the "Command line arguments" to the path of an HTML file that exercises your BHO.

在要调试的代码上设置断点。按F5时Internet Explorer将开始运行。你会看到断点变成空心,表明断点没有布防。 IE加载您的DLL后,在输出窗口中可见,它将变为纯红色。当IE调用您的代码时,调试器会自动中断。

Set a breakpoint on the code you want to debug. Internet Explorer will start running when you press F5. You'll see the breakpoint turning hollow, indicating that the breakpoint is not armed. As soon as IE loads your DLL, visible in the Output window, it will turn into a solid red. And the debugger automatically breaks when IE calls your code.

有一个注册步骤。请务必避免使用gacutil.exe,它只会污染计算机上的GAC。始终支持IDE中的注册COM互操作选项,相当于使用/ codebase选项运行Regasm.exe。这样就不需要GAC了。无论哪种方式,VS必须升级才能进行这些机器配置更改,通过右键单击快捷方式并选择以管理员身份运行来启动它。

There is a registration step. Do always avoid using gacutil.exe, it does nothing but pollute the GAC on your machine. Always favor the "Register for COM interop" option in the IDE, the equivalent of running Regasm.exe with the /codebase option. No need for the GAC that way. Either way, VS must be running elevated to make these machine config changes, start it by right-clicking the shortcut and selecting "Run as Administrator".

这篇关于如何在visual studio / internet explorer中调试C#BHO项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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