Skip to content

Fix packaging of design-time providers referenced via ProjectReference#19979

Open
T-Gro wants to merge 2 commits into
dotnet:mainfrom
T-Gro:fix/designtimeTP
Open

Fix packaging of design-time providers referenced via ProjectReference#19979
T-Gro wants to merge 2 commits into
dotnet:mainfrom
T-Gro:fix/designtimeTP

Conversation

@T-Gro

@T-Gro T-Gro commented Jun 22, 2026

Copy link
Copy Markdown
Member

Packing an F# library that activates a design-time type provider via a ProjectReference marked IsFSharpDesignTimeProvider="true" stopped including the provider assembly in the package (regressed by #18929).

dotnet pack collects per-framework content in an inner build with BuildProjectReferences=false, where @(_ResolvedProjectReferencePaths) is empty, so the old AfterTargets="ResolveReferences" form of PackageFSharpDesignTimeTools produced nothing. Registration of the content target moves back to evaluation time, and the target now resolves each provider through the SDK's own nearest-target-framework negotiation (GetTargetFrameworks -> GetReferenceNearestTargetFrameworkTask -> GetTargetPath). No reference build is triggered, so pack --no-build works (#12320) and ResolveReferences is not forced (#18924 stays fixed).

The provider is packaged under its own resolved target-framework folder — the moniker the compiler's design-time load actually probes for (src/Compiler/Facilities/CompilerLocation.fs), which is not necessarily the consumer's TargetFramework. The whole provider output travels with its subfolder layout preserved (culture satellites under <culture>/, native under runtimes/<rid>/...), so nothing is lost or collides on a shared file name; the consumer's own FSharp.Core / System.ValueTuple (and FSharp.Core's satellites) are excluded. A gesture that resolves to nothing, or to an output that was not built, fails loud instead of silently dropping.

The standard gesture now packages the provider on its own, so consumers no longer need a hand-written TargetsForTfmSpecificContentInPackage workaround.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No release notes required

@T-Gro T-Gro force-pushed the fix/designtimeTP branch 4 times, most recently from df6cb94 to 9e93c70 Compare June 22, 2026 11:21
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager ⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure labels Jun 22, 2026
@T-Gro T-Gro force-pushed the fix/designtimeTP branch 3 times, most recently from 4b67d9b to d3c65ef Compare June 23, 2026 13:30
@T-Gro T-Gro requested a review from abonie June 25, 2026 13:52
@T-Gro T-Gro force-pushed the fix/designtimeTP branch 3 times, most recently from 39c6ea9 to 88f0d53 Compare June 29, 2026 14:28
@T-Gro T-Gro force-pushed the fix/designtimeTP branch from 05adf75 to e81c715 Compare June 29, 2026 15:14
@github-actions github-actions Bot added the ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure label Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Build-Infra, Affects-Design-Time, Affects-Test-Tooling
Affects-Build-Infra: modifies Microsoft.FSharp.NetSdk.targets
Affects-Design-Time: changes design-time provider packaging resolution
Affects-Test-Tooling: end-to-end build test scripts spawn external processes

Generated by PR Tooling Safety Check · opus46 5.7M ·

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This review was generated by AI (@expert-reviewer agent). Findings may contain inaccuracies — please verify independently.

Nice, well-documented fix — the move to eval-time registration plus GetTargetFrameworks/GetReferenceNearestTargetFrameworkTask/GetTargetPath correctly avoids forcing ResolveReferences and keeps pack --no-build working, and the two fail-loud <Error> guards are a real improvement over the previous silent drop. Two robustness observations on the framework-folder derivation and the flattening glob; both are non-blocking.

Comment thread src/FSharp.Build/Microsoft.FSharp.NetSdk.targets Outdated
Comment thread src/FSharp.Build/Microsoft.FSharp.NetSdk.targets
@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Jun 30, 2026
@T-Gro T-Gro force-pushed the fix/designtimeTP branch 5 times, most recently from 98fb64a to 4b87c9a Compare July 1, 2026 12:14
@T-Gro T-Gro force-pushed the fix/designtimeTP branch 4 times, most recently from 4b0785f to 2b2f731 Compare July 1, 2026 13:55
@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Jul 1, 2026
T-Gro and others added 2 commits July 2, 2026 09:50
Packing an F# library that activates a design-time type provider via a
`ProjectReference` marked `IsFSharpDesignTimeProvider="true"` stopped including
the provider assembly in the package (regressed by dotnet#18929). PackageFSharpDesignTimeTools
now registers at evaluation time and resolves each provider through the SDK's own
nearest-target-framework negotiation (GetTargetFrameworks -> GetReferenceNearestTargetFrameworkTask
-> GetTargetPath), so no reference build is triggered (pack --no-build works, ResolveReferences
is not forced) and the whole provider output is packaged under the provider's resolved
target-framework folder with its subfolder layout preserved.

The existing EndToEndBuildTests Host->Provider case (previously a no-op placeholder)
now asserts the referenced provider is actually packaged under tools/fsharp41/: red
before this fix (provider silently dropped), green after.

Co-authored-by: Copilot App <[email protected]>
fsprojects/FSharp.Data.GraphQL pinned to d8aba70 (pre-workaround base of
FSharp.Data.GraphQL#583, bare IsFSharpDesignTimeProvider gesture): packs its
client and greps the produced package for the provider dll under typeproviders/.
Red without this fix (provider silently dropped from the package), green with it.

Co-authored-by: Copilot App <[email protected]>
@T-Gro T-Gro force-pushed the fix/designtimeTP branch from 2b2f731 to 534011d Compare July 2, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure AI-reviewed PR reviewed by AI review council

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants