Dependency management is a core feature of NuGet. Managing dependencies for a single project can be easy. Managing dependencies for multi-project solutions can prove to be difficult as they start to scale in size and complexity. In situations where you manage common dependencies for many different projects, you can leverage Central Package Management (CPM) features to do all of this from the ease of a single location.
Hence, this rules advises to enable Central Package Management by
enabling it with in the Directory.Packages.props
file:
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
</Project>
When a solution has only a tiny number of project files, and/or hardly any packages shared amongst these projects, CPM might be not worth the effort. In that case it is also fine to explicitly disable it in the project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>
</Project>
If you want to convert your large project to use CPM than you might want to use the CentralisedPackageConverter.