Skip to content

Commit 93d97dd

Browse files
authored
Add breaking change documentation for NuGet packages excluded from deps.json files (#48137)
1 parent cf641be commit 93d97dd

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
112112
| [MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed](sdk/10.0/custom-build-event-warning.md) | Behavioral change | Preview 1 |
113113
| [MSBuild custom culture resource handling](sdk/10.0/msbuild-custom-culture.md) | Behavioral change | Preview 1 |
114114
| [NU1510 is raised for direct references pruned by NuGet](sdk/10.0/nu1510-pruned-references.md) | Source incompatible | Preview 1 |
115+
| [NuGet packages with no runtime assets aren't included in deps.json](sdk/10.0/deps-json-trimmed-packages.md) | Source incompatible | Preview 5 |
115116
| [PackageReference without a version raises an error](sdk/10.0/nu1015-packagereference-version.md) | Behavioral change | Preview 6 |
116117
| [PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none](sdk/10.0/prune-packagereference-privateassets.md) | Behavioral change | Preview 7 |
117118
| [HTTP warnings promoted to errors in `dotnet package list` and `dotnet package search`](sdk/10.0/http-warnings-to-errors.md) | Behavioral/source incompatible change | Preview 4 |
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "Breaking change: NuGet packages with no runtime assets aren't included in deps.json"
3+
description: "Learn about the breaking change in .NET 10 where NuGet packages that don't contribute runtime assets might be excluded from deps.json files."
4+
ms.date: 08/27/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/48132
7+
---
8+
# NuGet packages with no runtime assets aren't included in deps.json
9+
10+
NuGet packages or other libraries that don't contribute any runtime assets are now excluded from the deps.json file if removing them wouldn't cause dependency resolution issues.
11+
12+
## Version introduced
13+
14+
.NET 10 Preview 5
15+
16+
## Previous behavior
17+
18+
Previously, all referenced NuGet packages and projects were included in the deps.json file as library entries, even if there were no assets used from them.
19+
20+
## New behavior
21+
22+
NuGet packages or other libraries might be excluded from the deps.json file if:
23+
24+
- They don't contribute any runtime assets, and
25+
- Removing the library from the deps.json would not cause any libraries that do contribute runtime assets to no longer have a dependency path to them.
26+
27+
## Type of breaking change
28+
29+
This change can affect [source compatibility](../../categories.md#source-compatibility).
30+
31+
## Reason for change
32+
33+
The deps.json file lists runtime dependencies and is used by the loader to load those dependencies. Some other tools also process the deps.json file. Including libraries that aren't actually used is less accurate and can lead to false positives for security scanners that use the deps.json file.
34+
35+
## Recommended action
36+
37+
To disable the new behavior, set the `TrimDepsJsonLibrariesWithoutAssets` MSBuild property to `false`:
38+
39+
```xml
40+
<PropertyGroup>
41+
<TrimDepsJsonLibrariesWithoutAssets>false</TrimDepsJsonLibrariesWithoutAssets>
42+
</PropertyGroup>
43+
```
44+
45+
## Affected APIs
46+
47+
None.
48+
49+
## See also
50+
51+
- [Pruning of framework-provided package references](../../../whats-new/dotnet-10/sdk.md#pruning-of-framework-provided-package-references)

docs/core/compatibility/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ items:
126126
href: sdk/10.0/msbuild-custom-culture.md
127127
- name: NU1510 is raised for direct references pruned by NuGet
128128
href: sdk/10.0/nu1510-pruned-references.md
129+
- name: NuGet packages with no runtime assets aren't included in deps.json
130+
href: sdk/10.0/deps-json-trimmed-packages.md
129131
- name: PackageReference without a version raises error
130132
href: sdk/10.0/nu1015-packagereference-version.md
131133
- name: PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none
@@ -826,7 +828,7 @@ items:
826828
href: core-libraries/6.0/system-drawing-common-windows-only.md
827829
- name: System.Security.SecurityContext is marked obsolete
828830
href: core-libraries/6.0/securitycontext-obsolete.md
829-
- name: Task.FromResult may return singleton
831+
- name: Task.FromResult might return singleton
830832
href: core-libraries/6.0/task-fromresult-returns-singleton.md
831833
- name: Unhandled exceptions from a BackgroundService
832834
href: core-libraries/6.0/hosting-exception-handling.md

0 commit comments

Comments
 (0)