Improved package debugging experience with the NuGet.org symbol server

November 16, 2018 by Karan Nandwani

Starting today, you can publish symbol packages to the NuGet.org symbol server. With NuGet.org as a single service provider for libraries and symbols, package authors and consumers will have a streamlined publishing and consumption experience. With a single place for managing authentication and identity, you can be sure that both the package and its symbols are coming from the same author when you consume a NuGet package from NuGet.org.

Publish a snupkg to the NuGet.org symbol server today!

We have introduced a new symbol package format - .snupkg. You will need Visual Studio 2017 15.9 to generate portable PDBs that can be packaged as .snupkg for publishing to the NuGet.org symbol server.

Create and publish snupkg to NuGet.org

  1. Compile your code using Visual Studio 2017 15.9 to generate the portable PDBs.

  2. Get nuget.exe 4.9.0 / dotnet.exe 2.1.500 or higher (Visual Studio 2017 15.9 ships with dotnet.exe 2.1.500 and msbuild).

  3. Create the .snupkg using pack with your tool of choice. We have added a new property SymbolPackageFormat, which must be set to snupkg

    using dotnet

    > dotnet pack MyAwesomeLib.csproj --include-symbols -p:SymbolPackageFormat=snupkg

    using nuget

    > nuget pack MyAwesomeLib.nuspec -Symbols -SymbolPackageFormat snupkg

    using msbuild

    > msbuild /t:pack MyAwesomeLib.csproj /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg

  4. Push the .nupkg to NuGet.org (we will detect the .snupkg and push it for you)

    using dotnet

    > dotnet nuget push MyAwesomeLib.1.0.0.nupkg -s https://api.nuget.org/v3/index.json -k ~~your API key here~~

    using nuget

    > nuget push MyAwesomeLib.1.0.1.nupkg -Source https://api.nuget.org/v3/index.json -apikey ~~your API key here~~

    using nuget.org upload

    nuget.org upload

  5. Once validated and indexed, the .snupkg will be available for consumption and will also be downloadable from the NuGet.org gallery.

    snupkg published

NuGet.org symbol server only accepts the new symbol package format .snupkg. Take a look at NuGet.org symbol package constraints for more info.

Consume snupkg from NuGet.org in Visual Studio

You will need Visual Studio 2017 15.9 to consume .snupkg from NuGet.org symbol server.

  1. In Visual Studio, open Tools > Options > Debugging > Symbols (or Debug > Options > Symbols).

  2. Under Symbol file (.pdb) locations, add a new symbol server location by selecting the + symbol in the toolbar. Use the following URL https://symbols.nuget.org/download/symbols.

    VS debug options

FAQs

  • Q. Can I submit a snupkg for an existing package on NuGet.org?
    To upload any .snupkg to NuGet.org, the hash of the .pdb must be embedded in the .dll that is included in the matching .nupkg. If the existing .nupkg on nuget.org does not include the .pdb hash, you will need to recompile and package your .nupkg with a compiler that supports this feature (such as the one that shipped with Visual Studio 2017 15.9), and push a new version before you can submit the corresponding .snupkg.

  • Q. Which PDB formats are supported?
    Currently, NuGet.org symbol server supports only the portable PDB format. The portable PDB format can be created and consumed for any .NET application provided that the consuming client is on .NET 4.7.1 or later. More info about Portable PDBs is available on the .NET GitHub.

  • Q. Where are the docs?
    Here are the docs for creating symbol packages (.snupkg) and the corresponding API docs.

We want to hear your feedback!

We want NuGet to meet the evolving needs of our community. Use the GitHub issue tracking this experience to provide feedback, or ask questions. You can also reach out me on twitter - mention @karann9 and @nuget in your tweets.