如何调试一个DLL项目

 

 

转自MSDNhttp://msdn.microsoft.com/zh-cn/library/605a12zt(v=VS.100).aspx

 

中文设置:

若要从 DLL 项目而不是从调用应用程序启动调试,必须在“<项目> 属性页对话框或窗口中输入信息以指示 DLL 项目在何处才能找到调用应用程序。C++属性页在布局和内容方面与 C# Visual Basic属性页不同。请参考与项目语言相对应的过程。

如果托管 DLL 由本机代码调用,并且您想要调试两者,则必须同时启用托管调试器和本机调试器。可以在“<Project> 属性页对话框或窗口中设置此项。有关更多信息,请参见 如何:在混合模式下调试

C++ 项目中指定调用应用程序

1.  解决方案资源管理器中选择 DLL 项目。

2.  视图菜单上选择属性页

3.  项目 属性页窗口中的配置下拉列表中,选择调试

4.  打开配置属性文件夹并选择调试类别。

5.  要启动的调试器列表中,选择本地 Windows 调试器远程 Windows 调试器

6.  命令远程命令框中单击下拉箭头,并从列表中选择浏览来找到应用程序。或者,键入应用程序的路径和名称。

7.  命令参数框中键入所有需要的程序参数。

C# Visual Basic 项目中指定调用应用程序

1.  解决方案资源管理器中选择 DLL 项目。

2.  视图菜单上选择属性页

3.  项目 属性页窗口中的配置下拉列表中,选择调试

4.  单击调试选项卡。

5.  可通过执行以下任一操作来启动应用程序:

1.  启动操作设置为启动外部程序

2.  启动外部程序框中,单击省略号按钮以通过浏览找到应用程序。

3.  命令行参数框中输入所有需要的程序参数。

6.  或者,可以在 URL 处调用应用程序。(如果要调试本地 ASP.NET 应用程序所使用的托管 DLL,可能会需要使用此方法。)

1.  启动操作下,选择启动浏览器显示 URL:”单选按钮。

2.  在紧邻的文本框中,键入 URL

DLL 项目中开始调试

1.  解决方案资源管理器中选择 DLL 项目。

2.  根据需要设置断点。

3.  项目 属性页对话框或窗口中输入调用应用程序的名称和位置。如果应用程序是控制台应用程序,请填写命令行参数(如果需要)。

 

 

 

英文设置:

 

To start debugging from the DLL project instead of the calling application, you must enter information in the <Project> Property Pages dialog box or window to indicate where the DLL project can find the calling application. The C++ Property Pages differ in layout and content from the C# and Visual Basic Property Pages. Refer to the procedure that corresponds to your project's language.

If a managed DLL is called by native code and you want to debug both, both managed and native debuggers must be enabled. You can set this in the <Project> Property Pagesdialog box or window. For more information, see How to: Debug in Mixed Mode.

To specify the calling application in a C++ project

1.  In Solution Explorer, select the DLL project.

2.  On the View menu, choose Property Pages.

3.  In the Project Property Pages window, in the Configuration drop-down list, choose Debug.

4.  Open the Configuration Properties folder, and select the Debugging category.

5.  In the Debugger to launch list, choose Local Windows Debugger or Remote Windows Debugger.

6.  In the Command or Remote Command box, click the drop-down arrow, and select Browse from the list to locate the application. Alternatively, type the path and name of the application.

7.  Type any necessary program arguments in the Command Arguments box.

To specify the calling application in a C# or Visual Basic project

1.  In Solution Explorer, select the DLL project.

2.  On the View menu, choose Property Pages.

3.  In the Project Property Pages window, in the Configuration drop-down list, choose Debug.

4.  Click the Debug tab.

5.  You can start the application by either doing the following:

1.  Set the Start Action to Start external program.

2.  In the Start external program box, click the ellipsis button to browse for the application.

3.  Enter any necessary program arguments in the Command Line Arguments box.

6.  Or, you can invoke an application at a URL. (You might want to do this if you are debugging a managed DLL used by a local ASP.NET application.)

1.  Under Start Action, select the Start browser in URL: radio button.

2.  In the adjoining text box, type the URL.

To start debugging from the DLL project

1.  In Solution Explorer, select the DLL project.

2.  Set breakpoints as needed.

3.  Enter the name and location of the calling application in the Project Property Pages dialog box or window. If the application is a console application, fill in the command line arguments, if it is necessary.

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值