如何调试一个DLL项目

来源:互联网 发布:ug8.0编程免费视频教程 编辑:程序博客网 时间:2024/04/28 15:10

 

 

转自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 startdebugging from the DLL project instead of the calling application, you mustenter information in the <Project> Property Pages dialog box orwindow to indicate where the DLL project can find the calling application. The C++ PropertyPages differ in layout and content from the C# and Visual Basic PropertyPages. Refer to the procedure that corresponds to your project's language.

If a managed DLLis called by native code and you want to debug both, both managed and nativedebuggers 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 thecalling application in a C++ project

1. In Solution Explorer, select theDLL 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 RemoteCommand box, click the drop-down arrow, and select Browse fromthe list to locate the application. Alternatively, type the path and nameof the application.

7. Type any necessary program arguments inthe Command Arguments box.

To specify thecalling application in a C# or Visual Basic project

1. In Solution Explorer, select theDLL 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 eitherdoing the following:

1. Set the Start Action to Startexternal program.

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

3. Enter any necessary program argumentsin the Command Line Arguments box.

6. Or, you can invoke an application at aURL. (You might wantto do this if you are debugging a managed DLL used by a local ASP.NETapplication.)

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

2. In the adjoining text box, type theURL.

To startdebugging from the DLL project

1. In Solution Explorer, select theDLL project.

2. Set breakpoints as needed.

3.  Enter the nameand location of the calling application in the Project Property Pages dialogbox or window. If theapplication is a console application, fill in the command line arguments, if itis necessary.