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
2 changes: 1 addition & 1 deletion docs/core/compatibility/10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,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 |
| [.NET tool packaging creates RuntimeIdentifier-specific tool packages](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
15 changes: 8 additions & 7 deletions docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
---
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."
title: "Breaking change: .NET tool packaging might create RuntimeIdentifier-specific tool packages"
description: "Learn about the breaking change in the .NET 10 SDK where .NET tool packaging might use RuntimeIdentifiers to create platform-specific tools"
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
# .NET tool packaging creates RuntimeIdentifier-specific tool packages

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.
The .NET tool packaging process has changed when `RuntimeIdentifiers` are present in the project.
Since the SDK now supports creating [platform-specific tools](https://github.com/dotnet/core/blob/main/release-notes/10.0/preview/preview6/sdk.md#platform-specific-net-tools), `RuntimeIdentifiers` are used to determine the set of platforms for which to create tool packages.

## 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.
Previously when you ran `dotnet pack` on a project with `PackAsTool` set to `true`, it ignored any `RuntimeIdentifiers`.

## 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.
Starting in .NET 10, `RuntimeIdentifiers` are used to determine the set of platforms for which to create tool packages.

## Type of breaking change

Expand All @@ -36,7 +37,7 @@ This change enables the creation of optimized, platform-specific .NET Tool packa

## Recommended action

If your project is impacted, remove any explicit file copy customizations.
If you want to create tools for only a subset of platforms, use `ToolPackageRuntimeIdentifiers`. If you want to disable RID-specific tool packages entirely, you should conditionally include or exclude the `RuntimeIdentifiers` property in your project file.

## Affected APIs

Expand Down
2 changes: 1 addition & 1 deletion docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ 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
- name: .NET tool packaging creates RuntimeIdentifier-specific tool packages
href: sdk/10.0/dotnet-tool-pack-publish.md
- name: "`dotnet restore` audits transitive packages"
href: sdk/10.0/nugetaudit-transitive-packages.md
Expand Down