galmeida
galmeida

Reputation: 248

Making debug symbols available in nuget package (from local server) without a symbol server

We have a local nuget package server but not a symbol server. Both the project which generates the package and the program which uses it are controlled by me.

After some research, it seemed that if I just packed the pdb together with the dll it should work.

dotnet pack -c Release --include-symbols --include-source --configfile W /p:PackageVersion=X Y -o Z

I had to do it 'manually', zipping the pdb inb the .symbols.nupkg produced into the nupkg. I did it, but visual studio can't detect the pdb file (I checked, its there in my machines .nuget folder). In the Debug > Modules windows it shows they weren't loaded for the package. I don't know if there is a problem with unmatching GUID between dll and pdb (or even if it was possible given i used a single 'dotnet pack' command). The tools I've found online to check this are dated and problematic (if there is an easy way, please tell me)

Then I tried the:

<DebugType>embedded</DebugType>

Approach. This time, Debug > Modules showed the symbols were loaded, the nupkg doesn't contain a pdb but it contains a src folder with the source code on it. However, when f12 a method and create a breakpoint inside the imported package, it says it wont work because "the breakpoint will not be hit..... the current source code is different from the version built into the dll". I don't know if it has to do with the fact that the build was made in a linux server while I'm debugging on Windows. Or with the fact that the tab containing the code reads "decompiled" - I didn't expect it would show me decompiled code, as the package came with the source and there was no need for decompilation.

Any hints, please.

Obs: Adding a direct reference to the local version of the project which generates the package instead of the adding the nuget package is problematic, since there are other nuget packages which use this package and VS ends up using the indirect reference. Also, I want to make it available to people who don't have access to the project, as well as repeat this pattern for all our packages.

Upvotes: 0

Views: 36

Answers (0)

Related Questions