The way that your NuGet package dependencies are managed changed over the years. Originally, the list of NuGet packages used by a project where managed inside a packages.config file.
More recently, the concept of a
<PackageReference /> got introduced that allowed you to manage your NuGet dependencies directly within your project file.
Both approaches manage dependencies at the project level. This is not ideal for multi-project solutions as every project can use different versions of the same dependency. Visual Studio can help you to consolidate package versions but it remains cumbersome when your solutions start to grow.
Starting with NuGet 6.2, you can centrally manage your dependency versions in your projects with the introduction of a
To get started with central package management, create a
Directory.Packages.props file at the root of your solution.
Remark: It is possible to use multiple
Directory.Packages.props files in different locations. In that case the props file closest to your project will be evaluated.
Inside this file, you need to specify the package version that should be used inside your solution through the
<PackageVersion /> element.
You still need to use the
<PackageReference /> in your project files, but without a
Version attribute to infer the centrally managed version instead.
To use NuGet Central Package management you need at least: