nuget-license
4.0.10
dotnet tool install --global nuget-license --version 4.0.10
dotnet new tool-manifest
dotnet tool install --local nuget-license --version 4.0.10
#tool dotnet:?package=nuget-license&version=4.0.10
nuke :add-package nuget-license --version 4.0.10
Nuget License Utility

Nuget License Utility is a tool to analyze, print, and validate the licenses of dependencies in .NET and C++ projects. It supports .NET (Core), .NET Standard, .NET Framework, and native C++ projects.
Features
- Analyze project or solution files for NuGet package licenses
- Validate licenses against an allowed list
- Download license files for auditing
- Supports transitive dependencies, custom mappings, and overrides
- Flexible output: table or JSON (pretty/minified)
- Exclude or ignore specific packages or projects
- Works with .NET Core, .NET Framework, and native C++ projects
Project Structure
This repository provides two main tools:
| Tool | Description | Supported Project Types |
|---|---|---|
| NuGetLicenseCore<br/>(dotnet tool) | Cross-platform .NET Core global tool, installed via dotnet tool install. |
.NET Core, .NET Standard, partial .NET Framework<sup>1</sup> |
| NuGetLicenseFramework.exe | Standalone .NET Framework executable. | .NET Core, .NET Standard, .NET Framework, native C++ |
<sup>1</sup> .NET Framework support via the dotnet tool may vary due to MSBuild/environment differences.
Compatibility Matrix
| Tool | .NET Core | .NET Standard | .NET Framework | Native C++ |
|---|---|---|---|---|
| NuGetLicenseCore<br/>(dotnet tool) | ✔️ | ✔️ | ⚠️<br/>Partial support | ❌ |
| NuGetLicenseFramework.exe | ✔️ | ✔️ | ✔️ | ✔️ |
Installation
NuGetLicenseCore (dotnet tool)
dotnet tool install --global nuget-license
NuGetLicenseFramework.exe
Download the latest release from GitHub Releases and run the executable directly.
Usage
Basic Command
nuget-license [options]
Common Options
| Option | Description |
|---|---|
--version |
Show version information. |
-i, --input <FILE> |
Project or solution file to analyze. |
-ji, --json-input <FILE> |
JSON file with an array of project/solution files to analyze. See docs/input-json.md. |
-t, --include-transitive |
Include transitive dependencies. |
-a, --allowed-license-types <FILE\|LIST> |
Specifies allowed license types. You can provide either a JSON file listing allowed license types (see docs/allowed-licenses-json.md), or a semicolon-separated list (e.g., "MIT;Apache-2.0;BSD-3-Clause"). |
-ignore, --ignored-packages <FILE\|LIST> |
Specifies package names to ignore during validation (supports wildcards). You can provide either a JSON file (see docs/ignored-packages-json.md), or a semicolon-separated list (e.g., "Package1;Package2"). |
-mapping, --licenseurl-to-license-mappings <FILE> |
Specifies a JSON dictionary mapping license URLs to license types. See docs/licenseurl-mappings-json.md. |
-file-mapping, --licensefile-to-license-mappings <FILE> |
Specifies a JSON dictionary mapping license files to license types. Paths are relative to the JSON file. See docs/licensefile-mappings-json.md. |
-override, --override-package-information <FILE> |
Specifies a JSON list to override package/license information. See docs/override-package-json.md. |
-d, --license-information-download-location <FOLDER> |
Specifies a folder where all license files will be downloaded. |
-o, --output <TYPE> |
Specifies the output format: Table, Markdown, Json or JsonPretty (default: Table). See docs/output-json.md for JSON format details. |
-err, --error-only |
When set, only validation errors are shown. |
-include-ignored, --include-ignored-packages |
When set, ignored packages are included in the output. |
-exclude-projects, --exclude-projects-matching <FILE\|LIST> |
Specifies projects to exclude from analysis. You can provide either a JSON file (see docs/exclude-projects-json.md), or a semicolon-separated list (e.g., "*Test*;Legacy*"). Wildcards (*) are supported. |
--exclude-publish-false |
Excludes packages marked with <Publish>false</Publish> metadata in the project file. This also recursively excludes transitive dependencies. A package is only excluded if all paths leading to it originate from a Publish="false" reference (consistent with dotnet publish behavior). |
-isp, --include-shared-projects |
Include shared projects (.shproj). |
-f, --target-framework <TFM> |
Analyze for a specific Target Framework Moniker. |
-fo, --file-output <FILE> |
Write output to a file instead of console. |
-?, -h, --help |
Show help information. |
Important Notes
Package Detection and Restore
nuget-license does not restore NuGet packages itself. It reads package information from the project.assets.json file (also known as the lock file) that is generated when you run dotnet restore or build your project.
Key points:
- The packages evaluated by nuget-license are always the ones that were used during the last package restore.
- If you use conditional package references (e.g., based on build configuration), only the packages from the last restore will be detected.
- Packages referenced in
Directory.Build.propsor other MSBuild files with conditions will only appear if they were included in the most recent restore operation.
To ensure all packages are detected:
Run
dotnet restore(ordotnet build) with the appropriate configuration before running nuget-license:dotnet restore -c Release nuget-license -i MyProject.csprojIf you need to analyze packages for different configurations, restore with each configuration separately:
# For Release configuration dotnet restore -c Release nuget-license -i MyProject.csproj -o JsonPretty -fo licenses-release.json # For Debug configuration dotnet restore -c Debug nuget-license -i MyProject.csproj -o JsonPretty -fo licenses-debug.jsonIf packages are missing from the output, verify that
project.assets.jsonexists in your project'sobjfolder and that a restore was performed recently.
Examples
Show Help
nuget-license --help
Validate licenses for a project
nuget-license -i MyProject.csproj
Validate licenses for a solution
nuget-license -i MySolution.sln
Use a custom allowed license list
Using a JSON file:
nuget-license -i MyProject.csproj -a allowed-licenses.json
Using inline semicolon-separated values:
nuget-license -i MyProject.csproj -a "MIT;Apache-2.0;BSD-3-Clause"
Ignore specific packages
Using a JSON file:
nuget-license -i MyProject.csproj -ignore ignored-packages.json
Using inline semicolon-separated values (supports wildcards):
nuget-license -i MyProject.csproj -ignore "InternalPackage1;InternalPackage2;Test*"
Generate pretty JSON output
nuget-license -i MyProject.csproj -o JsonPretty
See docs/output-json.md for detailed information about the JSON output format.
Download all license files
nuget-license -i MyProject.csproj -d licenses/
Map license files to license types
nuget-license -i MyProject.csproj -file-mapping license-file-mappings.json
Note: License file paths in the JSON are relative to the JSON file's directory.
Advanced Usage
- Multiple projects: Use
-jiwith a JSON file listing multiple projects/solutions. - Override package info: Use
-overrideto supply custom license info for specific packages. - Ignore packages: Use
-ignoreto skip in-house or known packages. - Exclude projects: Use
-exclude-projectsto skip test or sample projects.
Building from Source
- Clone the repository.
- Build with your preferred .NET SDK.
- For the dotnet tool:
dotnet pack NuGetLicenseCore - For the framework exe: build
NuGetLicenseFrameworkand use the resulting.exe.
License
See LICENSE for details.
Documentation
For detailed documentation on configuration files and advanced usage, please refer to the documentation files linked above in the GitHub repository. The links point to the documentation that was available at the time this package version was created (commit: 3814b41aa2e1228ba6b4d6a60c1135f6e05684e1).
| 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 is compatible. 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 is compatible. 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. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.10 | 35,943 | 5/6/2026 |
| 4.0.9 | 100,605 | 3/23/2026 |
| 4.0.8 | 51,839 | 2/23/2026 |
| 4.0.7 | 24,509 | 2/11/2026 |
| 4.0.7-beta.4 | 67 | 2/10/2026 |
| 4.0.7-beta.3 | 71 | 2/4/2026 |
| 4.0.7-beta.2 | 63 | 2/3/2026 |
| 4.0.7-beta.1 | 82 | 1/22/2026 |
| 4.0.6 | 54,767 | 1/16/2026 |
| 4.0.6-beta.2 | 73 | 1/16/2026 |
| 4.0.6-beta.1 | 77 | 1/15/2026 |
| 4.0.5 | 48,858 | 12/20/2025 |
| 4.0.4 | 605 | 12/19/2025 |
| 4.0.4-beta.2 | 172 | 12/19/2025 |
| 4.0.2 | 16,759 | 12/2/2025 |
| 4.0.2-beta.1 | 177 | 11/24/2025 |
| 4.0.1 | 28,946 | 11/12/2025 |
| 4.0.1-beta.2 | 198 | 11/7/2025 |
| 4.0.0 | 72,104 | 9/20/2025 |