πŸ’‘ Developer Tips / Quick NuGet Version Check with CPM
nuget

Quick NuGet Version Check with CPM

November 5, 2025 β€’ 1 min read
← Back to Tips
Quickly see all package versions in one place using NuGet Central Package Management (CPM). Perfect for dependency audits and keeping track of what versions you're using across multiple projects.

The Problem

Ever wondered "what version of EntityFramework are we using?" and had to check multiple .csproj files? With CPM, you can see everything at a glance.

The Solution

Create a Directory.Packages.props file at your solution root to centralize all package versions:

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>

  <ItemGroup>
    <PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
    <PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
    <PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
    <PackageVersion Include="xunit" Version="2.6.1" />
    <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
  </ItemGroup>
</Project>

Update Your Project Files

Remove version numbers from your .csproj files:

<!-- ❌ Before: versions scattered across projects -->
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />

<!-- βœ… After: versions managed centrally -->
<PackageReference Include="Microsoft.EntityFrameworkCore" />

🎯 Benefits

  • Single source of truth - All versions in one file
  • Easy updates - Change version once, affects all projects
  • No version conflicts - Ensures consistency across solution
  • Quick audit - See all dependencies at a glance

Pro Tips

πŸ’‘ Quick Commands

  • Add package: dotnet add package PackageName (auto-adds to Directory.Packages.props)
  • Update all: dotnet nuget update source
  • List outdated: dotnet list package --outdated

πŸ”§ Advanced Usage

You can also pin specific projects to different versions when needed:

<!-- In specific .csproj if you need different version -->
<PackageReference Include="Microsoft.EntityFrameworkCore" VersionOverride="7.0.14" />

πŸ’¬ Comments & Reactions

πŸ’¬ Comments & Reactions