-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document .NET Tool packaging breaking change for .NET 10 Preview 6 #47925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
docs/core/compatibility/sdk/10.0/dotnet-tool-pack-publish.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.