Creating symbol packages (.snupkg)
Symbol packages allow you to improve the debugging experience of your NuGet packages.
Creating a symbol package
You can create a snupkg symbol package using dotnet.exe, NuGet.exe, or MSBuild. If you're using NuGet.exe, you can use the following commands to create a .snupkg file in addition to the .nupkg file:
nuget pack MyPackage.nuspec -Symbols -SymbolPackageFormat snupkg nuget pack MyPackage.csproj -Symbols -SymbolPackageFormat snupkg
If you're using dotnet.exe or MSBuild, use the following steps to create a .snupkg file in addition to the .nupkg file:
Add the following properties to your .csproj file:
<PropertyGroup> <IncludeSymbols>true</IncludeSymbols> <SymbolPackageFormat>snupkg</SymbolPackageFormat> </PropertyGroup>
Pack your project with
dotnet pack MyPackage.csprojor
msbuild -t:pack MyPackage.csproj.
The legacy format
.symbols.nupkg is still supported but only for compatibility reasons (see Legacy Symbol Packages). NuGet.org's symbol server only accepts the new symbol package format -
Publishing a symbol package
For convenience, first save your API key with NuGet (see publish a package).
nuget SetApiKey Your-API-Key
After publishing your primary package to nuget.org, push the symbol package as follows.
nuget push MyPackage.snupkg
You can also push both primary and symbol packages at the same time using the below command. Both .nupkg and .snupkg files need to be present in the current folder.
nuget push MyPackage.nupkg
NuGet will publish both packages to nuget.org.
MyPackage.nupkg will be published first, followed by
If the symbol package isn't published, check that you've configured the NuGet.org source as
https://api.nuget.org/v3/index.json. Symbol package publishing is only supported by the NuGet V3 API.
NuGet.org symbol server
NuGet.org supports its own symbols server repository and only accepts the new symbol package format -
.snupkg. Package consumers can use the symbols published to nuget.org symbol server by adding
https://symbols.nuget.org/download/symbols to their symbol sources in Visual Studio, which allows stepping into package code in the Visual Studio debugger. See Specify symbol (.pdb) and source files in the Visual Studio debugger for details on that process.
Nuget.org symbol package constraints
The symbol packages supported on nuget.org have the following contraints
- Only the following file extensions are allowed to be added to a symbol package.
- Only managed Portable pdbs are currently supported on nuget symbol server.
- The pdbs and associated nupkg dlls need to be built with the compiler in Visual Studio version 15.9 or above (see pdb crypto hash)
The symbol package publish on nuget.org will fail if any other file types are included in the .snupkg.
Symbol package validation and indexing
Symbol packages published to NuGet.org undergo several validations, such as virus checks.
When the package has passed all validation checks, it might take a while for the symbols to index and be available for consumption from the NuGet.org symbol servers. If the package fails a validation check, the package details page for the .nupkg will update to display the associated error and you will also receive an email notifying you about it.
Package validation and indexing usually takes under 15 minutes. If the package publishing is taking longer than expected, visit status.nuget.org to check if nuget.org is experiencing any interruptions. If all systems are operational and the package hasn't been successfully published within an hour, please login to nuget.org and contact us using the Contact Support link on the package details page.
Symbol package structure
The .nupkg file would be exactly the same as it is today, but the .snupkg file would have the following characteristics:
The .snupkg will have the same id and version as the corresponding .nupkg.
The .snupkg will have the exact folder structure as the nupkg for any DLL or EXE files with the distinction that instead of DLLs/EXEs, their corresponding PDBs will be included in the same folder hierarchy. Files and folders with extensions other than PDB will be left out of the snupkg.
The .nuspec file in the .snupkg will also specify a new PackageType as below. This should the only one PackageType specified.
<packageTypes> <packageType name="SymbolsPackage"/> </packageTypes>
If an author decides to use a custom nuspec to build their nupkg and snupkg, the snupkg should have the same folder hierarchy and files detailed in 2).
ownersfield will be excluded from the snupkg's nuspec.
Do not use the
element. A .snupkg is covered under the same license as the corresponding .nupkg.