Skip to content

Commit dc17c8a

Browse files
authored
Document .NET Tool packaging breaking change for .NET 10 Preview 6 (#47925)
1 parent 75ef2aa commit dc17c8a

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
102102
| Title | Type of change | Introduced version |
103103
|-------|-------------------|--------------------|
104104
| [.NET CLI `--interactive` defaults to `true` in user scenarios](sdk/10.0/dotnet-cli-interactive.md) | Behavioral change | Preview 3 |
105+
| [.NET tool packaging invokes Publish instead of Build](sdk/10.0/dotnet-tool-pack-publish.md) | Behavioral change | Preview 6 |
105106
| [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 |
106107
| [`dotnet package list` performs restore](sdk/10.0/dotnet-package-list-restore.md) | Behavioral change | Preview 4 |
107108
| [`dotnet restore` audits transitive packages](sdk/10.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 3 |
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: "Breaking change: .NET tool packaging invokes Publish instead of Build"
3+
description: "Learn about the breaking change in the .NET 10 SDK where .NET tool packaging changed from invoking Build to Publish, affecting included assets."
4+
ms.date: 08/11/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/47916
7+
---
8+
9+
# .NET tool packaging invokes Publish instead of Build
10+
11+
The .NET tool packaging process changed from invoking the MSBuild `Build` target to the `Publish` target (logically, not precisely). This means that assets that are included in `Publish` but not in `Build`, like WebSDK StaticWebAssets, now appear in tool packages by default. If you explicitly copied those files into place, you might begin to receive build diagnostics warning of duplicate copies.
12+
13+
## Version introduced
14+
15+
.NET 10 Preview 6
16+
17+
## Previous behavior
18+
19+
Previously when you ran `dotnet pack` on a project with `PackAsTool` set to `true`, it invoked the `Build` target, and only `Build`-created assets were included in the package.
20+
21+
## New behavior
22+
23+
Starting in .NET 10, the tool packaging process invokes the `Publish` target, which means `Publish`-created assets are included in the package. This includes StaticWebAssets and minified and trimmed application assets.
24+
25+
## Type of breaking change
26+
27+
This is a [behavioral change](../../categories.md#behavioral-change).
28+
29+
## Reason for change
30+
31+
This change enables the creation of optimized, platform-specific .NET Tool packages, and supports use cases like:
32+
33+
- Self-contained tools.
34+
- Trimmed and AOT tools.
35+
- Tools that can eventually be used on platforms without an SDK or runtime installed.
36+
37+
## Recommended action
38+
39+
If your project is impacted, remove any explicit file copy customizations.
40+
41+
## Affected APIs
42+
43+
None.

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ items:
108108
items:
109109
- name: .NET CLI `--interactive` defaults to `true` in user scenarios
110110
href: sdk/10.0/dotnet-cli-interactive.md
111+
- name: .NET tool packaging invokes Publish instead of Build
112+
href: sdk/10.0/dotnet-tool-pack-publish.md
111113
- name: "`dotnet restore` audits transitive packages"
112114
href: sdk/10.0/nugetaudit-transitive-packages.md
113115
- name: Default workload configuration from 'loose manifests' to 'workload sets' mode

0 commit comments

Comments
 (0)