[英]Debugging Nuget package doesn't work
I'm trying to create a debugger nuget package. 我正在尝试创建一个调试器nuget包。 So, I start with "Creating symbol packages" . 所以,我从“创建符号包”开始 。 Create package using nuget pack PackageARM.nuspec -Symbols
使用nuget pack PackageARM.nuspec -Symbols
创建包
PackageARM.nuspec: PackageARM.nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>PackageARM</id>
<version>1.0.15</version>
<authors>PackageARM</authors>
<owners>PackageARM</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework=".NETStandard2.0" />
</dependencies>
</metadata>
<files>
<file src="bin\Release\netstandard2.0\*.pdb" target="lib\netstandard2.0" />
<file src="bin\Release\netstandard2.0\*.dll" target="lib\netstandard2.0" />
<file src="**\*.cs" target="src" />
</files>
</package>
And push it to nuget: https://www.nuget.org/packages/PackageARM/1.0.15 并将其推向nuget: https ://www.nuget.org/packages/PackageARM/1.0.15
Then uncheck Enable Just My Code
and check Enable source server support
in VS 2017. Also I tried to add symbol servers: https://www.nuget.org , https://nuget.smbsrc.net/ but no result. 然后取消选中Enable Just My Code
并选中在VS 2017中Enable source server support
。此外,我尝试添加符号服务器: https : //www.nuget.org,https : //nuget.smbsrc.net/但没有结果。
When I try step into method from package using F11 it just step to the next line. 当我尝试从包使用F11进入方法时,它只是步骤到下一行。 What I missed? 我错过了什么?
My pdb file contains path to .cs file that is 'C:\\project\\ProjectARM\\Class1.cs' it is ok? 我的pdb文件包含.cs文件的路径,即'C:\\ project \\ ProjectARM \\ Class1.cs'可以吗? how can other users debug if the doesn't have that path with source? 如果没有源路径,其他用户如何调试?
how can other users debug if the doesn't have that path with source? 如果没有源路径,其他用户如何调试?
Since you could not access the symbols package from the symbols server, we could not debugging on that way. 由于您无法从符号服务器访问符号包,因此我们无法以这种方式进行调试。 I would like provide you a workaround to debugging the nuget package. 我想为您提供调试nuget包的解决方法。
More detail on step 1: 第1步的更多细节:
I have checked your nuget package on the nuget.org, found that you have already put the .pdb
and source code file in the NuGet package alongside the .dll
. 我在nuget.org上检查了你的nuget包,发现你已经将.pdb
和源代码文件放在了.dll
旁边的NuGet包中。
More detail on step 2: 第2步的更多细节:
When you have a solution open, right click on Solution, select Properties...Common Properties...Debug Source Files, and add the root source directory for the relevant binary reference (Add the path of .cs
file in the Packages folder after install the nuget package): 打开解决方案后,右键单击Solution,选择Properties ... Common Properties ... Debug Source Files,然后添加相关二进制引用的根源目录 (在Packages文件夹中添加.cs
文件的路径)安装nuget包):
For some more details, please check this thread . 有关更多详细信息,请查看此主题 。
I've struggled with this for a long time. 我很长时间都在努力。 Here's the easiest way that I found that works repeatably: 这是我发现可重复工作的最简单方法:
Create a local nuget source: 创建本地nuget源:
Place the .nuget file that you just created in C:\\Nuget (for example) 将您刚刚创建的.nuget文件放在C:\\ Nuget中(例如)
In Visual Studio, select Tools / Options / Nuget Package Manager / Package Sources 在Visual Studio中,选择“工具/选项/ Nuget包管理器/包源”
Press the green (+) icon. 按绿色(+)图标。 Add the path to the local nuget package that you created above (C:\\Nuget) and move the package source to the top of the list. 将路径添加到上面创建的本地nuget包(C:\\ Nuget),并将包源移动到列表顶部。
In your solution, for each project, remove the previous reference to the external nuget package and add the new nuget package from your local nuget source. 在您的解决方案中,对于每个项目,删除先前对外部nuget包的引用,并从本地nuget源添加新的nuget包。
Start debugging and you should be able to step into the code for the nuget package. 开始调试,您应该能够进入nuget包的代码。
I'm able to set a breakpoint in the source code from where I build the nuget package and have it break when I run the code. 我能够在源代码中设置一个断点来构建nuget包,并在运行代码时将其断开。
All of the steps above are a little fidgity and you may need to play with it a few times to get it to work. 上面的所有步骤都有点狡猾,你可能需要玩几次才能让它发挥作用。
Let me know in the comments if this works for you. 如果这对您有用,请在评论中告诉我。 And if so, I'd appreciate an upvote! 如果是这样,我会欣赏一个upvote! :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.