Skip to content

[Breaking change]: .NET Tool packaging now invokes Publish instead of Build #47916

@baronfel

Description

@baronfel

Description

In dotnet/sdk#48575 as part of our overall improvements to .NET Tools to support platform-specific tools, we changed the MSBuild Target that the Tool packaging process invokes from Build to Publish (logically speaking, not precisely). This means that assets that are included in Publish but not in Build, like WebSDK StaticWebAssets will begin appearing in Tool packages by default. Users who explicitly copied those files into place may begin to receive build diagnostics warning them of duplicate copies.

Version

.NET 10 Preview 6

Previous behavior

dotnet pack on a project with PackAsTool set to true would call Build, causing only Build-time-created assets to be part of the package.

New behavior

Now, Publish-created assets are part of the package - notable StaticWebAssets, minified and trimmed application assets, etc.

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

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

  • self-contained tools
  • trimmed/AOT tools
  • eventually using tools on platforms without an SDK or Runtime installed at all.

Recommended action

Remove any explicit file Copy customisations that you had in impacted projects.

Feature area

SDK

Affected APIs

No response


Associated WorkItem - 480536

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions