如何重置 Visual Studio,以便它在调试时再次搜索 DLL 的源文件?
在调试我的 WPF 项目的过程中,我经常遇到抛出的异常。当这些异常触发时,如果异常是由我的应用程序代码引发的,我就可以浏览源代码。一切都很好。
但是,如果托管在另一个程序集中(我们构建的)的代码引发异常,我将无法浏览源代码。我在过去的某个时候被提示浏览原始源代码文件,但“取消”了该对话框。现在,我想要重来一次。
有没有办法让我重新定位这些源文件?我不再提示他们。我假设 Visual Studio 将我的源代码浏览首选项存储在某处,但我不知道在哪里。我知道这种重来是可能的,但我什至不知道在谷歌上搜索什么词才能得到我想要的东西。
我应该怎么办?
In the process of debugging my WPF project, I regularly encounter thrown exceptions. When these exceptions fire, if the exception is thrown by my application's code, I am able to browse the source code. All is well.
HOWEVER, if an exception is thrown by code hosted in another assembly (that we built), I am unable to browse for the source code. I was at some point in the past prompted to browse for the original source code file, but "canceled" the dialog. Now, I want a do-over.
Is there a way to grant me a do-over on locating these source files? I'm no longer prompted for them. I assume Visual Studio stores my source code browsing preferences somewhere, but I don't know where. I get the idea this do-over is possible, but I don't even know the words to search for on Google to get what I want.
What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在解决方案资源管理器中,右键单击解决方案,然后转到“属性”→“通用属性”→“调试源文件”。
然后在右侧有一个列表“不要查找这些源文件:”。从该列表中删除条目应该会再次提示您输入源位置。
In the Solution Explorer right click on the solution and go to Properties → Common Properties → Debug Source Files.
Then on the right hand side there is a list for "Do not look for these source files:". Deleting the entry from that list should prompt you for the source location again.
删除解决方案目录中隐藏的 .suo 文件。
Delete the hidden .suo file in your solution directory.
您可能需要重置视觉设置。您可以通过单击“工具”、“导入导出”设置来执行此操作。
对于默认源路径,请确保您的 PDB 文件在 Visual Studio 添加您的文件的位置正确替换引用 DLL 来自。 PDB文件包含源代码的路径,它不是Visual Studio。
在添加引用之前,您必须重建项目(引用的程序集之一)并手动删除调试项目中的 PDB 文件。如果文件被锁定或由于某种原因 PDB 文件可能无法更新,则可能是 Visual Studio 中的错误。
You may have to reset the visual settings. You can do this by clicking "Tools", Import Export settings.
For the default source path, make sure your PDB files are replaced correctly where Visual Studio is adding your reference DLL from. The PDB file contains the path of the source code, it's not Visual Studio.
You must rebuild your project (referenced assemblies one) and manually delete PDB files in your debugging project before adding references. It may be a bug in Visual Studio in case the files are locked or if for some reason the PDB files may not be updated.