Skip to content

Commit 15a09ed

Browse files
Copilotgewarren
andcommitted
Add breaking change documentation for .NET Tool packaging
Co-authored-by: gewarren <[email protected]>
1 parent b585b2d commit 15a09ed

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
9494
| Title | Type of change | Introduced version |
9595
|-------|-------------------|--------------------|
9696
| [.NET CLI `--interactive` defaults to `true` in user scenarios](sdk/10.0/dotnet-cli-interactive.md) | Behavioral change | Preview 3 |
97+
| [.NET Tool packaging now invokes Publish instead of Build](sdk/10.0/dotnet-tool-pack-publish.md) | Behavioral change | Preview 6 |
9798
| [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 |
9899
| [`dotnet package list` performs restore](sdk/10.0/dotnet-package-list-restore.md) | Behavioral change | Preview 4 |
99100
| [`dotnet restore` audits transitive packages](sdk/10.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 3 |
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "Breaking change: .NET Tool packaging now invokes Publish instead of Build"
3+
description: "Learn about the breaking change in .NET 10 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 now invokes Publish instead of Build
10+
11+
In .NET 10 Preview 6, the .NET Tool packaging process changed from invoking the `Build` target to the `Publish` target. This change enables optimized, platform-specific .NET Tool packages but affects which assets are included in the package.
12+
13+
## Version introduced
14+
15+
.NET 10 Preview 6
16+
17+
## Previous behavior
18+
19+
When you ran `dotnet pack` on a project with `PackAsTool` set to `true`, it invoked the `Build` target, causing only `Build`-time-created assets to be included in the package.
20+
21+
## New behavior
22+
23+
The tool packaging process now invokes the `Publish` target, which means `Publish`-created assets are included in the package. This includes:
24+
25+
- StaticWebAssets (from WebSDK)
26+
- Minified and trimmed application assets
27+
- Other publish-time optimizations
28+
29+
Users who previously copied these files explicitly may receive build diagnostics warning them of duplicate copies.
30+
31+
## Type of breaking change
32+
33+
This is a [behavioral change](../../categories.md#behavioral-change).
34+
35+
## Reason for change
36+
37+
This change enables the creation of optimized, platform-specific .NET Tool packages, supporting use cases like:
38+
39+
- Self-contained tools
40+
- Trimmed and AOT tools
41+
- Tools that can eventually be used on platforms without an SDK or Runtime installed
42+
43+
## Recommended action
44+
45+
Remove any explicit file copy customizations that you had in projects affected by this change. The assets that you were previously copying manually are now included automatically through the `Publish` process.
46+
47+
If you need to exclude specific assets that are now being included, you can customize the publish process by modifying your project file or using MSBuild properties to control which assets are included.
48+
49+
## Affected APIs
50+
51+
None.

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ items:
9898
items:
9999
- name: .NET CLI `--interactive` defaults to `true` in user scenarios
100100
href: sdk/10.0/dotnet-cli-interactive.md
101+
- name: .NET Tool packaging now invokes Publish instead of Build
102+
href: sdk/10.0/dotnet-tool-pack-publish.md
101103
- name: "`dotnet restore` audits transitive packages"
102104
href: sdk/10.0/nugetaudit-transitive-packages.md
103105
- name: Default workload configuration from 'loose manifests' to 'workload sets' mode

0 commit comments

Comments
 (0)