A simple, standalone, opinionated NuGet client for scripts to install packages - and their dependencies - to the global packages folder.
NuNuGet is a lightweight command-line tool that restores NuGet packages based on a simple JSON configuration file. It's designed for scenarios where you need to manage package dependencies outside of a traditional .NET project structure, such as native C++ projects that consume NuGet packages. It is not intended - or designed - to be run interactively, it is designed for build-systems to use to populate dependencies.
- JSON-based package list - Define packages in a simple JSON format instead of
.csprojfiles - Lock file support - Generate and use lock files for reproducible builds
- Custom NuGet configuration - Use a specific
nuget.configfor package sources - Cross-platform - Supports Windows (x64, ARM64), Linux (x64), and macOS (ARM64)
- Single-file deployment - Can be published as a self-contained single executable
Build from source:
dotnet buildOr publish as a single executable (see Publishing section below).
Install packages from a package list JSON file:
NuNuGet install --listFile <path> --configFile <path> --lockFile <path> [--verbose]| Option | Required | Description |
|---|---|---|
--configFile |
Yes | Path to the NuGet configuration file to use |
--listFile |
Yes | Path to the packages.list.json file to restore |
--lockFile |
Yes | Path to the NuGet lock file to use |
--verbose |
No | Enable verbose output |
NuNuGet install --configFile ./nuget.config --listFile ./packages.list.json --lockFile ./packages.lock.json --verboseThe package list is a JSON file that specifies the target framework and packages to install:
{
"targetFramework": "net8.0",
"packages": [
{
"id": "Newtonsoft.Json",
"version": "13.0.3"
},
{
"id": "Microsoft.Extensions.Logging",
"version": "8.0.0"
}
]
}| Property | Type | Description |
|---|---|---|
targetFramework |
string | The target framework moniker (e.g., native, net8.0, netstandard2.0) |
packages |
array | List of package entries |
packages[].id |
string | The NuGet package identifier |
packages[].version |
string | The version string (e.g., 1.8.2109, [1.0,2.0), 1.*) |
Build single-file executables for distribution:
# Framework-dependent single file
dotnet publish .\NuNuGet.csproj /p:PublishProfile=SingleFile
# Framework-dependent, trimmed
dotnet publish .\NuNuGet.csproj /p:PublishProfile=SingleFileTrimmed
# Self-contained, trimmed (Windows x64)
dotnet publish .\NuNuGet.csproj --runtime win-x64 /p:PublishProfile=SingleFileSelfContainedTrimmed
# Self-contained, trimmed (Windows ARM64)
dotnet publish .\NuNuGet.csproj --runtime win-arm64 /p:PublishProfile=SingleFileSelfContainedTrimmed| Profile | Description |
|---|---|
SelfContained |
Self-contained (no .NET runtime required) |
SingleFile |
Framework-dependent single file |
SingleFileSelfContained |
Self-contained single file (no .NET runtime required) |
SingleFileTrimmed |
Framework-dependent with IL trimming † |
SingleFileSelfContainedTrimmed |
Self-contained with IL trimming (no .NET runtime required) † |
† - Not yet working; trimming problems exist.
dotnet pack --configuration Release /blNuNuGet uses:
-
the official NuGet Client SDK libraries:
NuGet.Commands- Restore command infrastructureNuGet.Common- Common types and utilitiesNuGet.Packaging- Package reading and extractionNuGet.ProjectModel- Project model typesNuGet.Resolver- Dependency resolution
-
System.CommandLine- for command-line parsing -
Microsoft.Extensions.Logging- for common logging