How to create and publish nuget symbol packages

Creating a nuget package with symbols is quite easy.

You have 2 possible methods to create a nuget package with symbols:

  1. From nuspec file. How to create nuspec file.
    nuget pack MyPackage.nuspec -Symbols
    
  2. From project file.
    nuget pack MyProject.csproj -Symbols
    

Both of the commands will create 2 files {identifier}.symbols.nupkg and {identifier}.nupkg.

Publishing the nuget package

Normally I upload nuget package by just using drag&drop on the nuget upload page. This doesn't work with symbol packages, because you have 2 packages in the folder.

To publish symbol and normal package, you must use the nuget cli.

  1. Get and set your Nuget API key.
  2. Create both (normal + symbol) package. See the 2 possible options above.
  3. Run nuget push {identifier}.nupkg -Source https://www.nuget.org/api/v2/package.
    This will upload the {identifier}.nupkg to nuget and {identifier}.symbols.nupkgto the symbol server.

If the uploads were successful, result should look like this:
27936_symbol_package_upload

Part 2 of this tutorial will show how to use the symbol package to debug trough third party code.

Sources:
https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages
https://docs.microsoft.com/en-us/nuget/create-packages/publish-a-package


Posted Oct 27 2017, 11:39 AM by Holger Vetter
Filed under:
developers.de is a .Net Community Blog powered by daenet GmbH.