fix(packaging): inject patched WPF into self-contained publish output - #12
Open
oysteinkrog wants to merge 1 commit into
Open
fix(packaging): inject patched WPF into self-contained publish output#12oysteinkrog wants to merge 1 commit into
oysteinkrog wants to merge 1 commit into
Conversation
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>
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.
What this does
Makes the patched WPF DLLs survive a self-contained
dotnet publish, not justdotnet build.Why
InjectIfWpfAssembliesadds our patched WPF toResolvedFileToPublishfrom a Build-time target. A self-contained publish recomputes that list later in the SDK'sComputeResolvedFilesToPublishList, 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 localdotnet buildoutput 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 bothbuild/andbuildTransitive/):ReplaceWpfInPublish, hookedAfterTargets=ComputeResolvedFilesToPublishListandBeforeTargets=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.