Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/core/compatibility/10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
| Title | Type of change | Introduced version |
|-------|-------------------|--------------------|
| [.NET CLI `--interactive` defaults to `true` in user scenarios](sdk/10.0/dotnet-cli-interactive.md) | Behavioral change | Preview 3 |
| [.NET tool packaging invokes Publish instead of Build](sdk/10.0/dotnet-tool-pack-publish.md) | Behavioral change | Preview 6 |
| [Default workload configuration from 'loose manifests' to 'workload sets' mode](sdk/10.0/default-workload-config.md) | Behavioral change | Preview 2 |
| [`dotnet package list` performs restore](sdk/10.0/dotnet-package-list-restore.md) | Behavioral change | Preview 4 |
| [`dotnet restore` audits transitive packages](sdk/10.0/nugetaudit-transitive-packages.md) | Behavioral change | Preview 3 |
Expand Down
43 changes: 43 additions & 0 deletions docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: "Breaking change: .NET tool packaging invokes Publish instead of Build"
description: "Learn about the breaking change in the .NET 10 SDK where .NET tool packaging changed from invoking Build to Publish, affecting included assets."
ms.date: 08/11/2025
ai-usage: ai-assisted
ms.custom: https://github.com/dotnet/docs/issues/47916
---

# .NET tool packaging invokes Publish instead of Build

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.

## Version introduced

.NET 10 Preview 6

## Previous behavior

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.

## New behavior

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.

## Type of breaking change

This is a [behavioral change](../../categories.md#behavioral-change).

## Reason for change

This change enables the creation of optimized, platform-specific .NET Tool packages, and supports use cases like:

- Self-contained tools.
- Trimmed and AOT tools.
- Tools that can eventually be used on platforms without an SDK or runtime installed.

## Recommended action

If your project is impacted, remove any explicit file copy customizations.

## Affected APIs

None.
2 changes: 2 additions & 0 deletions docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ items:
items:
- name: .NET CLI `--interactive` defaults to `true` in user scenarios
href: sdk/10.0/dotnet-cli-interactive.md
- name: .NET tool packaging invokes Publish instead of Build
href: sdk/10.0/dotnet-tool-pack-publish.md
- name: "`dotnet restore` audits transitive packages"
href: sdk/10.0/nugetaudit-transitive-packages.md
- name: Default workload configuration from 'loose manifests' to 'workload sets' mode
Expand Down