fix: share tool templates across target frameworks - #11144
Merged
Merged
Conversation
Match packed templates by source path rather than SDK-dependent destination metadata. Refresh the shared-template runtime setting across pack, publish, and no-build transitions. Verify real package layout and installed template/HTML/PDF workflows in the three-platform CI matrix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bf666f99-8d30-4763-878d-b566c0ac2f2d
Report package-derived template directories, files, framework copies avoided, compressed and expanded sizes, and actual package size in the console and GitHub job summary. Label avoided-byte estimates separately from measured before/after package sizes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bf666f99-8d30-4763-878d-b566c0ac2f2d
Keep package regression commands and sharing metrics in the PR description and test script. Retain only the current .NET SDK prerequisite update in the README. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bf666f99-8d30-4763-878d-b566c0ac2f2d
vwxyzh
approved these changes
Sep 18, 2026
This was referenced Sep 18, 2026
This was referenced Sep 19, 2026
This was referenced Sep 23, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Restore the existing shared-template layout for the multi-target .NET tool. The release currently packs templates three times, once under each of
tools/net8.0/any,tools/net9.0/any, andtools/net10.0/any.templates/directory using the first target framework.Docfx.DotnetToolModewhile packing without incorrectly excluding the SDK's internal publish phase.--no-build, so installed tools use shared templates and normal/self-contained publish outputs continue using adjacent templates.No framework support, PDF functionality, source maps, dependencies, release tags, or signing behavior are removed or changed. This affects future packing, not already-published packages.
Root cause
The old
PackagePath.StartsWith("tools/<tfm>/any/templates/")condition does not match SDK 10's split destination metadata (PackagePath = tools/<tfm>/any/, with the remaining path inRecursiveDir). Also, SDK 10 sets both_IsPackingand_IsPublishingduring tool packing, so the old!_IsPublishingcondition suppresses the shared-template runtime switch.The fix does not depend on that destination-metadata shape. It identifies the actual template source files instead.
Measured package size
Same commit, generated templates, dependencies, version and local unsigned packing process:
Reduction: 21.6%. All 146 template source maps are retained once instead of three times. These are comparable local unsigned packages, not a claim that the final signed release will have exactly the same size.
Validation
publish -> pack --no-buildcheck reproduced stale runtime configuration before the final fix and passes afterward.win-x64publish outputs pass the same template/HTML/PDF checks without tool-mode leakage.docfx.Tests: 84 pass; 32 schema cases fail on an unchanged checkout-name assumption (PathHelperrequires a directory nameddocfxordocfx.sln, while this isolated checkout has another name and the repo usesdocfx.slnx). Two representative cases reproduce with the production project restored to unmodified main. This unrelated helper is not changed.CI package metrics
Each distribution-test step now writes a GitHub Actions job summary and console table containing the actual package frameworks, template directories/files, remaining framework-local entries, duplicate file copies avoided, compressed/expanded shared-template size, and actual package size. Estimated duplicate data avoided is explicitly labeled and excludes ZIP entry overhead; it is not presented as a separately built before/after measurement.