Skip to content

fix(packaging): inject patched WPF into self-contained publish output - #12

Open
oysteinkrog wants to merge 1 commit into
if/mainfrom
fix/publish-selfcontained-wpf-swap
Open

fix(packaging): inject patched WPF into self-contained publish output#12
oysteinkrog wants to merge 1 commit into
if/mainfrom
fix/publish-selfcontained-wpf-swap

Conversation

@oysteinkrog

Copy link
Copy Markdown
Member

What this does

Makes the patched WPF DLLs survive a self-contained dotnet publish, not just dotnet build.

Why

InjectIfWpfAssemblies adds our patched WPF to ResolvedFileToPublish from a Build-time target. A self-contained publish recomputes that list later in the SDK's ComputeResolvedFilesToPublishList, after the Build-time targets have run, and re-adds the runtime-pack stock WPF DLLs. So the published app shipped stock Microsoft WPF while local dotnet build output carried the fork.

This matters because the MotionCatalyst installer harvests the self-contained publish output. As-is, the switchover was inert in the shipped product: users got stock WPF, only developers' F5 builds got the fork. Found while validating the MotionCatalyst switchover (DESKTOP-11844): the four WPF DLLs in a Release self-contained publish were byte-identical to Microsoft's runtime pack.

What's in here

One new target in packaging/InitialForce.WPF/buildTransitive/InitialForce.WPF.targets (packed into both build/ and buildTransitive/): ReplaceWpfInPublish, hooked AfterTargets=ComputeResolvedFilesToPublishList and BeforeTargets=CopyFilesToPublishDirectory. It strips the stock WPF entries from the publish set and injects the patched copies at the point that wins.

How to review

Read the one target. The load-bearing part is the hook ordering: after the publish list is computed, before it is copied.

Verified locally against a patched if.116: a self-contained Release publish of MotionCatalyst now emits fork PresentationCore, PresentationFramework, WindowsBase and System.Xaml (sha256-matched to the package's runtimes copy), where before the fix all four were stock.

The Build-time InjectIfWpfAssemblies target adds the patched WPF DLLs to
ResolvedFileToPublish, but a self-contained publish recomputes that list in
ComputeResolvedFilesToPublishList after the Build-time targets have run, and
re-adds the runtime-pack stock WPF DLLs. The published app - which the
MotionCatalyst installer harvests - therefore shipped stock Microsoft WPF,
making the fork inert in the shipped product; only local dotnet build output
carried the patched DLLs.

Add ReplaceWpfInPublish, hooked AfterTargets=ComputeResolvedFilesToPublishList
and BeforeTargets=CopyFilesToPublishDirectory, to strip the stock WPF entries
and inject the patched copies at the point that wins. Verified locally: a
self-contained Release publish of MotionCatalyst now emits fork PresentationCore,
PresentationFramework, WindowsBase and System.Xaml (sha256-matched to the package
runtimes copy).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant