Skip to content

Commit 96233be

Browse files
authored
Update pruning breaking change for RC 1 (#48261)
1 parent 444dc32 commit 96233be

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
115115
| [NU1510 is raised for direct references pruned by NuGet](sdk/10.0/nu1510-pruned-references.md) | Source incompatible | Preview 1 |
116116
| [NuGet packages with no runtime assets aren't included in deps.json](sdk/10.0/deps-json-trimmed-packages.md) | Source incompatible | Preview 5 |
117117
| [PackageReference without a version raises an error](sdk/10.0/nu1015-packagereference-version.md) | Behavioral change | Preview 6 |
118-
| [PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none](sdk/10.0/prune-packagereference-privateassets.md) | Behavioral change | Preview 7 |
118+
| [PrunePackageReference privatizes direct prunable references](sdk/10.0/prune-packagereference-privateassets.md) | Behavioral change | Preview 7 |
119119
| [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 |
120120
| [NUGET_ENABLE_ENHANCED_HTTP_RETRY environment variable removed](sdk/10.0/nuget-enhanced-http-retry-removed.md) | Behavioral change | Preview 6 |
121121

docs/core/compatibility/sdk/10.0/nu1510-pruned-references.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
---
22
title: "Breaking change - NU1510 is raised for direct references pruned by NuGet"
33
description: "Learn about the breaking change in the .NET 10 SDK where NU1510 is raised for unnecessary direct package references."
4-
ms.date: 08/11/2025
4+
ms.date: 09/04/2025
55
ai-usage: ai-assisted
66
ms.custom: https://github.com/dotnet/docs/issues/45462
77
---
88

99
# NU1510 is raised for direct references pruned by NuGet
1010

11-
Starting in .NET 10, NuGet raises a [`NU1510` warning](/nuget/reference/errors-and-warnings/nu1510) when a project includes a direct package reference that overlaps with a framework-provided library and isn't required.
11+
Starting in the .NET 10 SDK, when pruning is enabled, NuGet raises a [`NU1510` warning](/nuget/reference/errors-and-warnings/nu1510) for projects that:
12+
13+
- Target or multi-target .NET 10 or a later version.
14+
- Include a direct package reference that overlaps with a framework-provided library (that is, the reference isn't necessary).
1215

1316
## Version introduced
1417

15-
.NET 10 Preview 1
18+
.NET 10
1619

1720
## Previous behavior
1821

1922
Previously, the .NET SDK ignored the contents of a package if it overlapped with a framework-provided library. The package reference was allowed but had no effect on the build output.
2023

2124
## New behavior
2225

23-
Starting in .NET 10, NuGet handles any unnecessary package references by raising a `NU1510` warning to notify you of the issue.
26+
Starting with the .NET 10 SDK, if pruning is enabled and the project targets .NET 10 or a later version, NuGet notifies you of any unnecessary package references by raising a `NU1510` warning.
2427

2528
> [!NOTE]
26-
> In a later .NET 10 preview, this behavior changed again such that direct prunable package references are automatically excluded from the `.nuspec` file. For more information, see [PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none](prune-packagereference-privateassets.md).
29+
> In a later .NET 10 preview, a related change was made such that [direct prunable package references](prune-packagereference-privateassets.md) are automatically excluded from the `.nuspec` file. However, you'll still get the `NU1510` warning to clean up your project.
2730
2831
## Type of breaking change
2932

@@ -56,4 +59,4 @@ None.
5659

5760
## See also
5861

59-
- [PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none](prune-packagereference-privateassets.md)
62+
- [PrunePackageReference privatizes direct prunable references](prune-packagereference-privateassets.md)

docs/core/compatibility/sdk/10.0/prune-packagereference-privateassets.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: "Breaking change - PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none"
2+
title: "Breaking change - PrunePackageReference privatizes direct prunable references"
33
description: "Learn about the breaking change in the .NET 10 SDK where PrunePackageReference automatically marks directly prunable PackageReference with PrivateAssets=all and IncludeAssets=none."
4-
ms.date: 01/03/2025
4+
ms.date: 09/04/2025
55
ai-usage: ai-assisted
66
---
77

8-
# PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none
8+
# PrunePackageReference privatizes direct prunable references
99

1010
The [PrunePackageReference](/nuget/consume-packages/package-references-in-project-files#prunepackagereference) feature automatically removes *transitive* packages that are provided by the target platform. With this change, the feature also marks *directly* prunable `PackageReference` items with `PrivateAssets=all` and `IncludeAssets=none` attributes. These attributes prevent the packages from appearing in generated dependency lists for packages.
1111

@@ -15,17 +15,17 @@ The [PrunePackageReference](/nuget/consume-packages/package-references-in-projec
1515

1616
## Previous behavior
1717

18-
In earlier .NET 10 previews, directly prunable `PackageReference` items might have generated an [`NU1510` warning](/nuget/reference/errors-and-warnings/nu1510) but still appeared in the generated *.nuspec* dependencies for all target frameworks, even those where the package is provided by the platform.
18+
Starting in .NET 10 Preview 1, if pruning was enabled, directly prunable `PackageReference` items might have generated an [`NU1510` warning](/nuget/reference/errors-and-warnings/nu1510) but still appeared in the generated *.nuspec* dependencies list, even if the package was provided by the platform.
1919

2020
For example, consider a multi-targeting project with the following configuration:
2121

2222
```xml
2323
<PropertyGroup>
24-
<TargetFramework>net9.0;net472</TargetFramework>
24+
<TargetFramework>net10.0;net472</TargetFramework>
2525
</PropertyGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="System.Text.Json" Version="9.0.4" />
28+
<PackageReference Include="System.Text.Json" Version="9.0.8" />
2929
</ItemGroup>
3030
```
3131

@@ -34,26 +34,26 @@ Such a project file generated a *.nuspec* file with dependencies for both target
3434
```xml
3535
<dependencies>
3636
<group targetFramework=".NETFramework4.7.2">
37-
<dependency id="System.Text.Json" version="9.0.4" />
37+
<dependency id="System.Text.Json" version="9.0.8" />
3838
</group>
39-
<group targetFramework="net9.0">
40-
<dependency id="System.Text.Json" version="9.0.4" />
39+
<group targetFramework="net10.0">
40+
<dependency id="System.Text.Json" version="9.0.8" />
4141
</group>
4242
</dependencies>
4343
```
4444

4545
## New behavior
4646

47-
Starting in .NET 10 Preview 7, directly prunable `PackageReference` items are automatically marked with `PrivateAssets=all` and `IncludeAssets=none`, which excludes them from the generated dependencies for target frameworks where they're provided by the platform.
47+
Starting in .NET 10 Preview 7, when pruning is enabled, directly prunable `PackageReference` items are automatically marked with `PrivateAssets=all` and `IncludeAssets=none`, which excludes them from the generated dependencies for target frameworks where they're provided by the platform. (However, if your project targets .NET 10 or later, you'll still get the `NU1510` warning until you remove the reference from your project.)
4848

49-
The same project configuration now generates a *.nuspec* file with the prunable dependency removed from the target framework that provides it (.NET 9):
49+
The same project configuration now generates a *.nuspec* file with the prunable dependency removed from the target framework that provides it (.NET 10):
5050

5151
```xml
5252
<dependencies>
5353
<group targetFramework=".NETFramework4.7.2">
54-
<dependency id="System.Text.Json" version="9.0.4" />
54+
<dependency id="System.Text.Json" version="9.0.8" />
5555
</group>
56-
<group targetFramework="net9.0">
56+
<group targetFramework="net10.0">
5757
</group>
5858
</dependencies>
5959
```

docs/core/compatibility/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ items:
132132
href: sdk/10.0/deps-json-trimmed-packages.md
133133
- name: PackageReference without a version raises error
134134
href: sdk/10.0/nu1015-packagereference-version.md
135-
- name: PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none
135+
- name: PrunePackageReference privatizes direct prunable references
136136
href: sdk/10.0/prune-packagereference-privateassets.md
137137
- name: HTTP warnings promoted to errors in package list and search
138138
href: sdk/10.0/http-warnings-to-errors.md

0 commit comments

Comments
 (0)