You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/compatibility/10.0.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,7 +115,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
115
115
|[NU1510 is raised for direct references pruned by NuGet](sdk/10.0/nu1510-pruned-references.md)| Source incompatible | Preview 1 |
116
116
|[NuGet packages with no runtime assets aren't included in deps.json](sdk/10.0/deps-json-trimmed-packages.md)| Source incompatible | Preview 5 |
117
117
|[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 |
# NU1510 is raised for direct references pruned by NuGet
10
10
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).
12
15
13
16
## Version introduced
14
17
15
-
.NET 10 Preview 1
18
+
.NET 10
16
19
17
20
## Previous behavior
18
21
19
22
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.
20
23
21
24
## New behavior
22
25
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.
24
27
25
28
> [!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.
27
30
28
31
## Type of breaking change
29
32
@@ -56,4 +59,4 @@ None.
56
59
57
60
## See also
58
61
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)
Copy file name to clipboardExpand all lines: docs/core/compatibility/sdk/10.0/prune-packagereference-privateassets.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
-
title: "Breaking change - PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none"
2
+
title: "Breaking change - PrunePackageReference privatizes direct prunable references"
3
3
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
5
5
ai-usage: ai-assisted
6
6
---
7
7
8
-
# PrunePackageReference marks direct prunable references with PrivateAssets=all and IncludeAssets=none
8
+
# PrunePackageReference privatizes direct prunable references
9
9
10
10
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.
11
11
@@ -15,17 +15,17 @@ The [PrunePackageReference](/nuget/consume-packages/package-references-in-projec
15
15
16
16
## Previous behavior
17
17
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.
19
19
20
20
For example, consider a multi-targeting project with the following configuration:
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.)
48
48
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):
0 commit comments