PackageReference
PackageReference is the standard way to declare NuGet package dependencies in SDK-style projects, such as those that target .NET Core and newer .NET versions. It replaces older approaches like packages.config by embedding dependency information directly in the project file. When a project uses PackageReference, NuGet resolves the declared packages and their transitive dependencies during restore.
In a project file, PackageReference entries are placed inside an ItemGroup. A typical entry looks like:
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
Additional metadata can be specified, such as Version ranges, and assets behavior. For example, Version="^13.0.0" expresses
During restore, NuGet computes the exact set of package versions to use and records the result in
Advantages of PackageReference include simplified project maintenance, elimination of separate per-project packages.config files, and automatic handling