How to package and deploy a NuGet package with symbols and source code so that debugger can use THAT source code?

Back in Feb'2019 it was working. Few things which are not mentioned here and I added to csproj file are

<DebugSymbols>true</DebugSymbols>
<EmbedAllSources>true</EmbedAllSources>
<DebugType>portable</DebugType>

I packaged with nuget and command used is:

nuget pack mynuget.nuspec -Symbols -SymbolPackageFormat snupkg

I was using VS 15.9.4 and nuget 4.9.3 at that time With this I could successfully debug nuget from network path . Not sure what changed in recent releases, its not working now.


Some fundamentals:

  • the debugger needs PDBs to enable debugging
  • a symbol package should contain PDBs (it is not merely a package with a different extension)
  • this symbol package should be published to a symbol repository that Visual Studio debugger can request symbols from

Next:

  1. See this doc for creating and publishing symbols package to nuget.org (.snupkg)
  2. Then, see this doc for configuring visual studio to for using NuGet.org as a symbol source (use this value when adding a symbol server https://symbols.nuget.org/download/symbols)