简体   繁体   English

Visual Studio:调试引用的DLL,我在另一个SLN中有源代码

[英]Visual Studio: Debugging a referenced DLL, I have source in another SLN

I am trying to debug a project that has a reference to a DLL that I added, the DLL is stored in an external directory and I just added a reference. 我正在尝试调试一个项目,该项目引用了我添加的DLL,DLL存储在外部目录中,我只是添加了一个引用。 Now of course I can debug my project but the line that calls a method on my other dll I can't step into it, ie F12. 现在我当然可以调试我的项目,但在我的另一个dll上调用方法的行我不能介入它,即F12。

One way I was able to do this was to add my project (dll) as an existing project to my solution and replace the referenced dll to use the attached project rather than a file on disk. 我能够做到这一点的一种方法是将我的项目(dll)作为现有项目添加到我的解决方案中,并替换引用的dll以使用附加的项目而不是磁盘上的文件。

But what a mess, I am sure there is a cleaner way? 但真是一团糟,我相信有更干净的方式?

I seem to remember if I copy some PDB files or something but i can't remember. 我似乎记得,如果我复制一些PDB文件或东西,但我不记得了。 And Do i need to open 2 copies of visual studio, 1 for my main project and 1 for my referenced DLL?? 我是否需要打开2个visual studio副本,1个用于我的主项目,1个用于我引用的DLL?

Rebuild the second solution in Debug mode on your own machine (so that file paths in that PDB are specific to your machine). 在您自己的计算机上以调试模式重建第二个解决方案(以便该PDB中的文件路径特定于您的计算机)。

Copy both the .DLL and .PDB files to your references folder. 无论是.dll和.pdb文件复制到文件夹引用。 Visual Studio will pick up the .PDB file automatically and use the file paths to show source. Visual Studio将自动获取.PDB文件并使用文件路径显示源。

You can also use Symbol Server and Source Server to achieve this when the referenced assembly is built elsewhere: http://msdn.microsoft.com/en-us/library/vstudio/ms241613.aspx 您可以使用Symbol Server和Source Server在其他地方构建引用的程序集时实现此目的: http//msdn.microsoft.com/en-us/library/vstudio/ms241613.aspx

I got the solution by doing the below 我通过以下方式得到了解决方案

Try disabling Just My Code (JMC). 尝试禁用Just My Code(JMC)。

Tools -> Options -> Debugger Uncheck "Enable Just my Code" 工具 - >选项 - >调试器取消选中“仅启用我的代码”

I had same problem which I resolved by cleaning and rebuilding the solution . 我有同样的问题,我通过清理和重建解决方案解决了。 It will correct references in .pdb files to locate and hit the break point in second project. 它将纠正.pdb文件中的引用以查找并命中第二个项目中的断点。

When you do a Debug build, all of the dll and pdb files are established in the host project. 执行Debug构建时,所有dll和pdb文件都在宿主项目中建立。 So there should be no need to copy files manually. 因此,不需要手动复制文件。

Right-Click on the Solution, select Add/Existing Project... Navigate to the Class lib folder and select the proj file (eg myproj.csproj). 右键单击Solution,选择Add / Existing Project ...导航到Class lib文件夹并选择proj文件(例如myproj.csproj)。 The files are not copied, just referenced and you can open the source for the class in the IDE and set breakpoints in the normal way and it just works. 文件不会被复制,只是被引用,你可以在IDE中打开类的源代码并以正常方式设置断点,它只是起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio中调试引用的DLL - Debugging referenced DLL in Visual Studio Visual Studio Solution(.sln) / C#:以另一个项目的 dll 作为参数启动一个项目 - Visual Studio Solution(.sln) / C#: Start a project with another project's dll as parameter 如何从Visual Studio 2012调试引用的dll - How can I debug a referenced dll from Visual Studio 2012 “无可用源” - Visual Studio调试(即使已加载符号) - “No Source Available” - Visual Studio Debugging (even when symbols have loaded) 如何在Visual Studio中查找所有源代码和引用的dll中的类/方法的所有引用? - How to find all reference of a Class/Method in all source code AND referenced dll in visual studio? 找不到引用的Nuget DLL,可以在Visual Studio中正常工作 - Referenced Nuget DLL Not Found Working Visual Studio 防止 Visual Studio 复制引用的 dll - Prevent Visual Studio from duplicating referenced dll 当我们没有该dll的源代码时,如何在Visual Studio中调试非托管dll? - How to debug unmanaged dll in Visual studio, when we dont have source for that dll? 在Visual Studio中调试第三方DLL? - Debugging a third-party DLL in Visual Studio? 调试Visual Studio宏中引用的自定义dll - Debug custom dll that is being referenced in visual studio macro
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM