diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 6406589933843..1d760d800ab87 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -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 | diff --git a/docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md b/docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md new file mode 100644 index 0000000000000..6263d81483d88 --- /dev/null +++ b/docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md @@ -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. diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 9f99fed62c5cb..1e9b8f5ccb8c4 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -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