使用附加到进程在 Visual Studio 2008 中调试 DLL 项目
我正在使用 C# .NET 2.0 和 Visual Studio 2008 Professional 开发 DLL。我想使用“附加到进程”对其进行调试(即设置断点)并将其附加到应用程序的可执行文件。我认为这是有效的;至少,我没有收到任何错误消息。但是,我尝试设置的任何断点都会被禁用,并显示一条小警告消息,指出“当前不会命中断点。尚未为此文档加载任何符号。”任何关于如何使用断点进行调试的想法将不胜感激。不幸的是,我不能简单地从 VS 运行该应用程序,因为它的安装过程很复杂;我需要以某种方式将 DLL 附加到已安装的可执行文件(如果需要,我可以切换该文件)并使用断点进行调试。谢谢。
I am developing a DLL using C# .NET 2.0 and Visual Studio 2008 Professional. I would like to debug (i.e. set a breakpoint in) it using Attach to Process and attaching it to the application's executable. I think this is working; at least, I'm not getting any error messages. However, any breakpoints that I try to set get disabled with a little warning message on them stating, "The breakpoint will not currently be hit. No symbols have been loaded for this document." Any thoughts on how I can get debugging with breakpoints working would be much appreciated. Unfortunately, I cannot simply run the application from VS because of the complex nature of its install process; I need to somehow attach the DLL to the installed executable (I can switch the file out, if need be) and debug with breakpoints. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您拥有尝试附加的代码的调试版本。如果它是没有 pdb 文件的发行版本,您将收到您所描述的错误。还要确保您在“附加到”选择器中选择了正确的类型。选择器应设置为“自动”或“托管”。
享受!
Make sure you have a debug version of the code you're trying to attach to. If it's a release version with no pdb files you will get the error you're describing. Also make sure you have have the correct type selected in the "Attach to" selector. The selector should be set to Automatic or Managed.
Enjoy!
如果您确定您有调试版本并且源代码与您要附加的版本匹配,请检查您的“调试 - Windows - 模块”窗口,并检查您正在调试的程序集的所有位置、其版本和 pdb 位置。这将帮助您缩小问题范围。
If you are sure you have a debug build and the source code matches the build you are attaching to, then check your Debug - Windows - Modules window, and check all the locations for the assemblies you are debugging, their versions, and pdb locations. This will help you narrow down the issue.