Maybe I have to build on my own local Nuget server and use a local
Symbol server too, but it looks overkill?
As far as l know, when you want to debug a nuget library in a new project, you must add the required nuget.pdb
and related xxx.cs
source files in the new project.
According to your description, the nuget package is created by yourself which is more easiler to realize it:
1) If you have the nuget.pdb file and the corresponding cs file on the local, you just need to put the PDB file in the output file of the project which references the nuget, and then right-click on the Solution-->Properties
-->Common Properties
-->Debug Source Files
-->to add the folder path which the cs files exist into it.
2) If you do not have the current nuget.pdb
file and related cs source files for debugging on the local, you need to include these files in nuget.nupkg
when creating the nuget package by using nuget.exe cli with xxx.nuspec
, so that these files can be added to the current agent when you install the nuget package.
**Note:**This is the special steps for creating your nuget package:
A) please make sure that you have downloaded the nuget.exe and then set its path to environment variables so that it can be called in CMD. You can refer to this.
B) Open CMD, type cd xxxxxx(the path of the project which contains xxxx.csproj
)
C) type nuget spec
to generate the xxx.spec
file
Then open it and add like these:
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
........
</metadata>
<files>
<file src="binDebugClassLibrary11.pdb" target="libarget framework version (like net472 or netstandard2.0)" />------ClassLibrary11.pdb is the nuget.pdb
<file src="Class1.cs" target="src" />------Class1.cs is the source file
</files>
</package>
D) then type nuget pack
to generate the nuget package which contains these debug files.
E) when you install this nuget package in a new project, please do not forget to clean the nuget cache first. After that, you should add the path of the resource files into Debug Source Files
.(the resource files exists in the C:Usersxxx.nugetpackagespackage namesrc
or C:xxxxxConsoleApp(project folder)packagespackage namesrc
)
Edit
F) When you start debugging it, please do not forget to disable Just My Code
In Tools
-->Options
-->Debugging
-->General
-->uncheck Enable Just My Code
.
Also, you can consider source links as source control so that you won't configure the source path by Solution=>properties.
In addition, you can refer to this similar issue.