.NET core tool that verifies that all NuGet packages in a solution are consolidated.
Developers typically consider it bad practice to use different versions of the same NuGet package across different projects in the same solution.
The tool finds such discrepancies.
dotnet tool install dotnet-consolidate --global
Pass a solution file as a parameter
dotnet consolidate -s YourSolution.sln
or multiple solutions
dotnet consolidate -s YourSolution.sln AnotherSolution.sln
You can also optionally specify the a package ID if you want only a single package to be consolidated
dotnet consolidate -s YourSolution.sln -p PackageId
or a list of package IDs if you want to consolidate multiple, but not all which are referenced in the solution projects
dotnet consolidate -s YourSolution.sln -p PackageID1 PackageID2
If the tool finds discrepancies between projects (only the specified ones if -p is given), it exits with non-success status code and prints these discrepancies.
dotnet consolidate -s umbraco.sln
✅ Output:
All packages are consolidated.
dotnet consolidate -s Sentry.sln
❌ Output:
Found 5 non-consolidated packages
----------------------------
Newtonsoft.Json
----------------------------
Sentry - 11.0.2
Sentry - 6.0.8
----------------------------
Microsoft.Extensions.Logging.Configuration
----------------------------
Sentry.Extensions.Logging - 2.1.0
Sentry.Extensions.Logging - 3.0.0
----------------------------
Microsoft.Extensions.DependencyInjection
----------------------------
Sentry.AspNetCore - 2.1.0
Sentry.Extensions.Logging.Tests - 2.1.1
Sentry.Extensions.Logging.Tests - 3.0.0
----------------------------
Microsoft.Extensions.Configuration.Json
----------------------------
Sentry.Extensions.Logging.Tests - 2.1.1
Sentry.Samples.GenericHost - 2.1.1
Sentry.Extensions.Logging.Tests - 3.0.0
----------------------------
Microsoft.AspNetCore.TestHost
----------------------------
Sentry.Testing - 2.1.1
Sentry.Testing - 3.1.0