NuGet.Packaging
7.3.1
Prefix Reserved
dotnet add package NuGet.Packaging --version 7.3.1
NuGet\Install-Package NuGet.Packaging -Version 7.3.1
<PackageReference Include="NuGet.Packaging" Version="7.3.1" />
<PackageVersion Include="NuGet.Packaging" Version="7.3.1" />
<PackageReference Include="NuGet.Packaging" />
paket add NuGet.Packaging --version 7.3.1
#r "nuget: NuGet.Packaging, 7.3.1"
#:package NuGet.Packaging@7.3.1
#addin nuget:?package=NuGet.Packaging&version=7.3.1
#tool nuget:?package=NuGet.Packaging&version=7.3.1
Nuget.Packaging
NuGet.Packaging is a NuGet client SDK library that provides a set of APIs to interact with .nupkg and .nuspec files from a stream. It provides a way for developers to create and read packages and work with the package metadata.
Usage
It is strongly recommended that NuGet packages are created using the official NuGet tooling and instead of this low-level API. There are a variety of characteristics important for a well-formed package and the latest version of tooling helps incorporate these best practices.
For more information about creating NuGet packages, see the overview of the package creation workflow and the documentation for official pack tooling (for example, using the dotnet CLI).
Examples
Create a package
Create a package, set metadata, and add dependencies.
PackageBuilder builder = new PackageBuilder();
builder.Id = "MyPackage";
builder.Version = new NuGetVersion("1.0.0-beta");
builder.Description = "My package created from the API.";
builder.Authors.Add("Sample author");
builder.DependencyGroups.Add(new PackageDependencyGroup(
targetFramework: NuGetFramework.Parse("netstandard1.4"),
packages: new[]
{
new PackageDependency("Newtonsoft.Json", VersionRange.Parse("10.0.1"))
}));
using FileStream outputStream = new FileStream("MyPackage.nupkg", FileMode.Create);
builder.Save(outputStream);
Console.WriteLine($"Saved a package to {outputStream.Name}");
Read a package
Read a package from a file.
using FileStream inputStream = new FileStream("MyPackage.nupkg", FileMode.Open);
using PackageArchiveReader reader = new PackageArchiveReader(inputStream);
NuspecReader nuspec = reader.NuspecReader;
Console.WriteLine($"ID: {nuspec.GetId()}");
Console.WriteLine($"Version: {nuspec.GetVersion()}");
Console.WriteLine($"Description: {nuspec.GetDescription()}");
Console.WriteLine($"Authors: {nuspec.GetAuthors()}");
Console.WriteLine("Dependencies:");
foreach (PackageDependencyGroup dependencyGroup in nuspec.GetDependencyGroups())
{
Console.WriteLine($" - {dependencyGroup.TargetFramework.GetShortFolderName()}");
foreach (var dependency in dependencyGroup.Packages)
{
Console.WriteLine($" > {dependency.Id} {dependency.VersionRange}");
}
}
Additional documentation
More information about the NuGet.Packaging library can be found on the official Microsoft documentation page and NuGet API docs.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- Newtonsoft.Json (>= 13.0.3)
- NuGet.Configuration (>= 7.3.1)
- NuGet.Versioning (>= 7.3.1)
- System.Text.Json (>= 8.0.5)
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- NuGet.Configuration (>= 7.3.1)
- NuGet.Versioning (>= 7.3.1)
- System.Security.Cryptography.Pkcs (>= 8.0.1)
NuGet packages (138)
Showing the top 5 NuGet packages that depend on NuGet.Packaging:
| Package | Downloads |
|---|---|
|
NuGet.Protocol
NuGet's implementation for interacting with feeds. Contains functionality for all feed types. |
|
|
Microsoft.DotNet.Scaffolding.Shared
Contains interfaces for Project Model and messaging for scaffolding. |
|
|
NuGet.Packaging.Core
The (former home to) core data structures for NuGet.Packaging. Contains only the type forwarders to the new assembly. |
|
|
Nuke.Tooling
The AKEless Build System for C#/.NET Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit '8aaec258a7e00e5d98e013be025db1a42bc58d79' (see contained AppVeyorSettings.json file for build settings). |
|
|
Microsoft.CodeAnalysis.Analyzer.Testing
Roslyn Analyzer Test Framework Common Types. |
GitHub repositories (70)
Showing the top 20 popular GitHub repositories that depend on NuGet.Packaging:
| Repository | Stars |
|---|---|
|
DevToys-app/DevToys
A Swiss Army knife for developers.
|
|
|
dotnet/runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
|
|
|
MonoGame/MonoGame
One framework for creating powerful cross-platform games.
|
|
|
unoplatform/uno
Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
|
|
|
RicoSuter/NSwag
The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
|
|
|
nissl-lab/npoi
a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
|
|
|
dotnet/msbuild
The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
|
|
|
dotnet/winforms
Windows Forms is a .NET UI framework for building Windows desktop applications.
|
|
|
cake-build/cake
:cake: Cake (C# Make) is a cross platform build automation system.
|
|
|
scriban/scriban
A fast, powerful, safe and lightweight scripting language and engine for .NET
|
|
|
fluentassertions/fluentassertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, as well as .NET Core 2.1, .NET Core 3.0, .NET 6, .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
|
|
|
nuke-build/nuke
🏗 The AKEless Build System for C#/.NET
|
|
|
waf/CSharpRepl
A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
|
|
|
coverlet-coverage/coverlet
Cross platform code coverage for .NET
|
|
|
projectkudu/kudu
Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
|
|
|
dotnet/sdk
Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
|
|
|
open-rpa/openrpa
Free Open Source Enterprise Grade RPA
|
|
|
Pryaxis/TShock
☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
|
|
|
serenity-is/Serenity
Business Apps Made Simple with Asp.Net Core MVC / TypeScript
|
|
|
NuGetPackageExplorer/NuGetPackageExplorer
Create, update and deploy Nuget Packages with a GUI
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 7.3.1 | 136,817 | 4/14/2026 | |
| 7.3.0 | 473,376 | 2/10/2026 | |
| 7.0.3 | 5,654 | 4/14/2026 | |
| 7.0.1 | 627,528 | 11/24/2025 | |
| 7.0.0 | 116,055 | 11/11/2025 | |
| 6.14.3 | 35,480 | 4/14/2026 | |
| 6.14.0 | 2,501,146 | 5/13/2025 | |
| 6.13.2 | 1,029,383 | 2/28/2025 | |
| 6.13.1 | 472,762 | 2/12/2025 | |
| 6.12.5 | 27,962 | 4/14/2026 | |
| 6.12.4 | 63,680 | 5/7/2025 | |
| 6.12.1 | 7,748,418 | 11/12/2024 | |
| 6.12.0 | 15,403 | 11/12/2024 | |
| 6.11.2 | 13,279 | 4/14/2026 | |
| 6.11.1 | 4,927,385 | 10/1/2024 | |
| 6.11.0 | 22,363,269 | 8/13/2024 | |
| 6.10.2 | 31,493 | 8/12/2024 | |
| 6.8.2 | 881 | 4/14/2026 | |
| 5.11.7 | 1,275 | 4/14/2026 | |
| 4.9.7 | 137 | 4/14/2026 |