lr.Dotnet.NugetConfigTool 2026.4.18.234
lr-nuget-config
A command-line tool that creates build/obj/nuget.override.config by merging your repo's nuget.config with user-level NuGet credentials and environment variable URL overrides.
Usage
Run it directly with dnx:
dnx -y lr.Dotnet.NugetConfigTool
Examples
Run in the current directory (walks up to find repo root):
dnx -y lr.Dotnet.NugetConfigTool
Run for a specific repo:
dnx -y lr.Dotnet.NugetConfigTool ~/projects/my-repo
How it works
- Repo root discovery — walks up the directory tree to find
.gitornuget.config - URL overrides — for each package source in
nuget.config, checks for an environment variable derived from the source name:DigitalHubDotnet->DIGITAL_HUB_DOTNET_NUGET_FEED_URLnuget.org->NUGET_ORG_NUGET_FEED_URL- If the env var is set, the source URL is overridden
- Credential merge — reads
packageSourceCredentialsfrom~/.nuget/NuGet/NuGet.Configand merges credentials for matching source names - Writes
build/obj/nuget.override.config— used byRestoreConfigFileinDirectory.Build.props
When to run
- After cloning a repo — run once to bootstrap the override config with your credentials
- In CI pipelines — set URL override env vars, then run before
dotnet restore
Env var naming convention
Source key names are split on PascalCase boundaries, dots, hyphens, and underscores, uppercased, and suffixed with _NUGET_FEED_URL:
| Source key | Env var |
|---|---|
DigitalHubDotnet |
DIGITAL_HUB_DOTNET_NUGET_FEED_URL |
nuget.org |
NUGET_ORG_NUGET_FEED_URL |
MyFeed-v2 |
MY_FEED_V2_NUGET_FEED_URL |
Requirements
- .NET 10.0 or later
Installation
dotnet tool install -g lr.Dotnet.NugetConfigTool
Usage after installation:
lr-nuget-config [directory]
This package has no dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 2026.4.18.234 | 4 | 04/18/2026 |
| 2026.4.18.129 | 5 | 04/18/2026 |