This guide will help you get started with the enhanced package analysis features of CentralConfigGenerator.
- .NET SDK 9.0 or later
- CentralConfigGenerator installed globally
Navigate to your solution directory and run:
central-config packages-enhanced -vThis will:
- Scan all project files
- Detect version conflicts
- Show a visual analysis report
- Ask for confirmation before making changes
You'll see a comprehensive report like this:
Package Analysis Summary
┌─────────────────────────┬─────────┐
│ Metric │ Value │
├─────────────────────────┼─────────┤
│ Total Packages │ 15 │
│ Packages with Conflicts │ 3 │
│ Warnings │ 4 │
└─────────────────────────┴─────────┘
Version Conflicts Detected:
┌─────────────────────┬──────────────────┬─────────────┬─────────────┐
│ Package │ Project │ Version │ Type │
├─────────────────────┼──────────────────┼─────────────┼─────────────┤
│ Newtonsoft.Json │ Web.csproj │ 11.0.2 │ Release │
│ Newtonsoft.Json │ Core.csproj │ 13.0.3 │ Release │
│ │ │ │ │
│ Serilog │ Web.csproj │ 2.10.0 │ Release │
│ Serilog │ Tests.csproj │ 3.0.1 │ Release │
└─────────────────────┴──────────────────┴─────────────┴─────────────┘
The tool will automatically resolve conflicts using the highest version strategy. You'll be asked to confirm:
Version conflicts were detected. Continue with resolved versions? [y/n] (y):
After confirmation, the tool will:
- Create a
Directory.Packages.propsfile - Remove version attributes from project files
- Show a summary of changes
central-config packages-enhanced -d ./src/MyProjects -vcentral-config packages-enhanced --overwritecentral-config packages-enhanced --dry-runIf you have both pre-release and stable versions:
<!-- Project1.csproj -->
<PackageReference Include="MyPackage" Version="1.0.0-beta" />
<!-- Project2.csproj -->
<PackageReference Include="MyPackage" Version="1.0.0" />Result: The stable version 1.0.0 will be selected.
When projects use version ranges:
<!-- Project1.csproj -->
<PackageReference Include="MyPackage" Version="[1.0.0,2.0.0)" />
<!-- Project2.csproj -->
<PackageReference Include="MyPackage" Version="1.5.0" />Result: The range [1.0.0,2.0.0) will be preserved as it encompasses the specific version.
The tool will warn about significantly outdated packages:
Warnings:
┌─────────┬─────────────────────┬─────────────────────────────────────────────┐
│ Level │ Package │ Message │
├─────────┼─────────────────────┼─────────────────────────────────────────────┤
│ Warning │ EntityFramework │ This version is significantly outdated │
└─────────┴─────────────────────┴─────────────────────────────────────────────┘
If you have versions like $(MyVersion):
<PackageReference Include="MyPackage" Version="$(MyVersion)" />These will be preserved as-is in the centralized configuration.
When multiple pre-release versions conflict:
MyPackage 1.0.0-alpha.1
MyPackage 1.0.0-beta.1
The tool correctly identifies that beta.1 is newer than alpha.1.
- Review Before Confirming: Always review the conflict resolution before accepting
- Test After Migration: Run your tests after centralizing package versions
- Use Stable Versions: Prefer stable versions over pre-release in production
- Regular Updates: Run the analysis periodically to keep versions consistent
- Learn about version management details
- Read the full documentation
If you encounter issues:
- Run with verbose logging:
central-config packages-enhanced -v - Open an issue on GitHub