CentralNuGetUpdater 1.1.0
See the version list below for details.
dotnet tool install --global CentralNuGetUpdater --version 1.1.0
dotnet new tool-manifest
dotnet tool install --local CentralNuGetUpdater --version 1.1.0
#tool dotnet:?package=CentralNuGetUpdater&version=1.1.0
nuke :add-package CentralNuGetUpdater --version 1.1.0
Central NuGet Package Updater
A console application that helps you manage and update NuGet packages in .NET projects using Central Package Management (Directory.Packages.props). The tool respects your nuget.config source rules and provides an interactive interface to select which packages to update.
Features
- ✅ Central Package Management Support: Works with
Directory.Packages.props
files - ✅ NuGet.config Compliance: Respects package sources and configuration from
nuget.config
- ✅ Seamless Authentication: Uses the same credential providers as
dotnet restore
- ✅ Interactive Selection: Choose which packages to update with a beautiful console UI
- ✅ Update Preview: See current vs. latest versions before updating
- ✅ Dry Run Mode: Preview what would be updated without making changes
- ✅ Prerelease Support: Optionally include prerelease versions
- ✅ Detailed Information: Shows package descriptions and publish dates
- ✅ Error Handling: Graceful handling of network issues and missing packages
Prerequisites
- .NET 8.0 or later
- An existing .NET project using Central Package Management
Installation
Option 1: Global .NET Tool (Recommended)
Install as a global .NET tool for easy access from anywhere:
dotnet tool install -g CentralNuGetUpdater
Then use it anywhere:
cpup --help
Option 2: Build from Source
Clone or download this repository
Navigate to the project directory
Build the application:
dotnet build -c Release
Run the application:
dotnet run -- [options]
Option 3: Publish as Self-Contained
Publish the application for your platform:
# Windows dotnet publish -c Release -r win-x64 --self-contained # macOS dotnet publish -c Release -r osx-x64 --self-contained # Linux dotnet publish -c Release -r linux-x64 --self-contained
The executable will be in
bin/Release/net8.0/[runtime]/publish/
Usage
Basic Usage
Navigate to your .NET solution directory (containing Directory.Packages.props
) and run:
# If installed as global tool
cpup
# If running from source
dotnet run
Command Line Options
Central NuGet Package Updater - Check and update packages in Directory.Packages.props
Usage:
cpup [options]
Options:
-p, --path <path> Path to Directory.Packages.props file or the directory containing it [default: current directory]
-c, --config <config> Path to nuget.config file (optional)
--pre, --prerelease Include prerelease versions when checking for updates [default: False]
-d, --dry-run Show what would be updated without making changes [default: False]
--version Show version information
-?, -h, --help Show help and usage information
Examples
Check for updates in current directory
# Global tool
cpup
# From source
dotnet run
Check specific directory or file
# Using directory path
cpup --path "C:\MyProject"
# Using direct file path
cpup --path "C:\MyProject\Directory.Packages.props"
# With custom nuget.config
cpup --path "C:\MyProject" --config "C:\MyProject\nuget.config"
Include prerelease versions
cpup --prerelease
Dry run (preview only)
cpup --dry-run
Combine options
cpup --path "C:\MyProject" --prerelease --dry-run
Central Package Management Setup
If your project doesn't use Central Package Management yet, you need to:
- Create a
Directory.Packages.props
file in your solution root:
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
- Update your project files (.csproj) to remove version attributes:
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" />
NuGet.config Support
The tool automatically discovers and uses your nuget.config
file. It supports:
- Package Sources: Respects enabled/disabled sources
- Source Mapping: Uses package source mapping rules
- Authentication: Works with authenticated feeds
- Fallback Sources: Uses fallback feeds when configured
Example nuget.config
:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="MyCompanyFeed" value="https://pkgs.dev.azure.com/company/_packaging/feed/nuget/v3/index.json" />
</packageSources>
</configuration>
Authentication Support
The tool uses the same credential providers as dotnet restore
, ensuring seamless authentication with private NuGet feeds without any additional setup.
🔐 How Authentication Works
- Automatic Integration: The tool integrates with NuGet's built-in credential provider system
- Zero Configuration: If
dotnet restore
works with your private feeds, this tool will work too - Same Credentials: Uses existing Azure Artifacts Credential Provider, AWS CodeArtifact, MyGet, and other installed credential providers
- Silent Authentication: No interactive prompts - authentication happens transparently
✅ Supported Authentication Methods
The tool automatically supports any authentication method that dotnet restore
supports:
- Azure DevOps Artifacts - Uses Azure Artifacts Credential Provider
- GitHub Packages - Uses stored PATs or GitHub CLI authentication
- AWS CodeArtifact - Uses AWS credential providers
- MyGet - Uses stored API keys or credential providers
- Corporate NuGet feeds - Uses domain authentication or configured credentials
- Any credential provider - Supports NuGet's extensible credential provider system
🚀 Quick Setup for Azure DevOps
If you're using Azure DevOps and haven't set up authentication yet:
Install Azure Artifacts Credential Provider:
# Using dotnet tool (recommended) dotnet tool install -g Azure.Artifacts.CredentialProvider # Or download from: https://github.com/microsoft/artifacts-credprovider
Test with dotnet restore:
dotnet restore --interactive
Run this tool - it will work automatically!
🎯 Authentication Flow
✓ Credential service configured - will use same authentication as 'dotnet restore'
ℹ Loaded 2 package source(s)
ℹ - nuget.org: https://api.nuget.org/v3/index.json
ℹ - MyCompanyFeed: https://pkgs.dev.azure.com/company/_packaging/feed/nuget/v3/index.json
ℹ Checking for updates for 25 packages...
That's it! No interactive prompts, no manual credential entry - just seamless authentication using your existing setup.
🔒 Security & Credentials
- Existing Credentials: Uses credentials already configured for
dotnet restore
- No Storage: The tool doesn't store or manage credentials directly
- Secure: Leverages NuGet's secure credential provider infrastructure
- Consistent: Same security model as all other .NET CLI tools
How It Works
- Discovery: Finds
Directory.Packages.props
in the specified directory - Parsing: Extracts all
PackageVersion
elements - Configuration: Loads NuGet sources from
nuget.config
- Authentication: Automatically uses the same credential providers as
dotnet restore
- Version Check: Queries each configured source for the latest version
- Interactive Selection: Presents packages with updates for user selection (all selected by default)
- Update: Modifies
Directory.Packages.props
with selected updates
Output Example
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Central NuGet Package Updater
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Found 8 packages
Packages with available updates:
┌─────────────────────────────────────────┬─────────────────┬───────────────┬────────────┐
│ Package │ Current Version │ Latest Version│ Published │
├─────────────────────────────────────────┼─────────────────┼───────────────┼────────────┤
│ Microsoft.Extensions.DependencyInjection│ 7.0.0 │ 8.0.0 │ 2023-11-14 │
│ Newtonsoft.Json │ 13.0.1 │ 13.0.3 │ 2023-03-17 │
│ Serilog │ 3.0.1 │ 3.1.1 │ 2023-10-16 │
└─────────────────────────────────────────┴─────────────────┴───────────────┴────────────┘
Select packages to update:
? Which packages would you like to update?
[X] Microsoft.Extensions.DependencyInjection (7.0.0 → 8.0.0) ← All selected by default
[X] Newtonsoft.Json (13.0.1 → 13.0.3)
[X] Serilog (3.0.1 → 3.1.1)
Publishing as Global Tool
To publish updates to NuGet.org:
Update version in
CentralNuGetUpdater.csproj
Create package:
dotnet pack -c Release
Publish to NuGet.org:
dotnet nuget push bin/Release/CentralNuGetUpdater.*.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json
Contributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Troubleshooting
Common Issues
"Directory.Packages.props not found"
- Ensure you're running the command in the correct directory
- Use the
--path
option to specify the correct path
"No packages found"
- Check that your
Directory.Packages.props
containsPackageVersion
elements - Verify the XML format is correct
- Check that your
"Failed to check version for package"
- Check your internet connection
- Verify your
nuget.config
sources are accessible - Some corporate networks may require proxy configuration
Authentication issues with private feeds
- Ensure
dotnet restore
works with your private feeds first - The tool uses the same credential providers and configuration as
dotnet restore
- Install the appropriate credential provider (e.g., Azure Artifacts Credential Provider for Azure DevOps)
- Ensure
Corporate proxy issues
- Ensure your corporate proxy settings are configured in your NuGet configuration
- Some corporate environments may require additional certificate configuration
Getting Help
If you encounter issues:
- Check the troubleshooting section above
- Run with
--dry-run
to see what would happen without making changes - Verify your
nuget.config
is properly configured - For authentication issues, ensure
dotnet restore
works with your feeds first - Open an issue with details about your setup and the error message
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. |
This package has no dependencies.