Back to results for “.NET CLI”
.NET › .NET vs .NET Framework

How does packages.config differ from PackageReference, and which is used in Framework versus modern .NET projects?

Intermediate

Answer

packages.config is the older NuGet dependency format used in classic .NET Framework projects, storing package references in a separate XML file and physically copying package assemblies into a packages folder. PackageReference, used by default in modern SDK-style .csproj files (and adoptable in newer Framework projects too), declares dependencies directly inside the project file and uses a global NuGet cache instead of per-project copies, simplifying dependency management and enabling transitive dependency resolution.
<!-- packages.config (legacy) -->
<packages>
  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
</packages>

<!-- PackageReference (modern, in .csproj) -->
<ItemGroup>
  <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Real-world example A legacy Framework project migrating dependency management converts from packages.config to PackageReference using Visual Studio's built-in migration tool, immediately reducing repository size since packages are no longer copied locally.

Common follow-ups: How does the global NuGet cache reduce disk usage across projects?;Can packages.config and PackageReference coexist during a transition?