Introduction
A .nupkg file is a package for NuGet,
the package manager for .NET. It holds a library’s compiled assemblies, often built
for several versions of .NET, with a manifest naming the package, its version and the
packages it depends on. Projects list the packages they use, and the .NET tools download
them from nuget.org or another feed when the project is restored. Packages of debugging
symbols use the same format with the extension .snupkg.
Structure
A NuGet package is a ZIP archive laid out as an Open
Packaging Conventions package. At its root is the .nuspec manifest, an XML
file with the package’s ID, version, authors, description, licence and dependencies.
Assemblies go in lib/, in a folder per target framework such as
lib/net8.0/ or lib/netstandard2.0/. Other folders hold
build files, content and native runtimes. A signed package adds a
.signature.p7s file.
Newtonsoft.Json.13.0.3.nupkg
├── Newtonsoft.Json.nuspec
├── lib/
│ ├── net45/Newtonsoft.Json.dll
│ └── netstandard2.0/Newtonsoft.Json.dll
├── [Content_Types].xml
├── _rels/.rels
├── package/services/metadata/core-properties/….psmdcp
└── .signature.p7s
Links
Software
- .NET SDK, whose
dotnet packanddotnet add packagemake and use them (Windows, macOS, Linux) - Visual Studio, with its NuGet package manager (Windows)
- nuget.exe, the NuGet command line (Windows)
- NuGet Package Explorer, which opens and edits them (Windows)
Reference
- .nuspec reference, Microsoft