Repository navigation
Do not publish precompressed RCL assets from Blazor Hybrid apps - #70634
joshbarros wants to merge 1 commit into
Conversation
|
Thanks for your PR, @joshbarros. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head 1541c07cd0cdaca24092e46dd6f06a454e5fe8e4.
One unresolved P2 candidate is attached inline: the new target removes precompressed StaticWebAsset items without explicitly removing corresponding endpoint items. The frozen ASP.NET Core source establishes the changed edge and publish trigger, but the external Microsoft.NET.Sdk.StaticWebAssets implementation required to prove endpoint reconciliation is not in the bundle, so this is not presented as a verified defect.
Per-guide completion:
docs/CrossCuttingGuidance.md: complete; change shape, compatibility, MSBuild condition/metadata, packaging, cross-platform behavior, and source-level test coverage assessed.docs/BlazorComponentsGuidance.md: complete; packaging scope, target ordering, filtering, consumer impact, comments, and source-level test boundary assessed.
Existing-feedback coverage: none; the frozen feedback contains only the policy bot acknowledgement and /review invocation. Feedback posted after bundle preparation was not observable.
Uncovered areas: none materially changed outside the routed cross-cutting and Blazor Components guides. Security assessment and execution of builds, publishes, tests, CI, browser workflows, and samples were explicitly excluded.
Provenance: version-2 frozen bundle for PR #70634; head 1541c07cd0cdaca24092e46dd6f06a454e5fe8e4, merge base 59835e6087e90b972a905dc303523cfbb5d828ef, base tip and trusted guidance commit 18781e9d03cba0f3df9cdf7fae90f77771ca9f00. Proof is source-only. No target code was executed.
Limitations: tracked Git bytes only; symlinks, submodules, and LFS pointers are inert. Runtime MSBuild behavior and the external SDK task implementation were unavailable, and no changed regression test covers this publish-output scenario.
Generated by ASP.NET Core Pull Request Review for #70634 · copilot · gpt56 · 159.3 AIC · ⌖ 8.57 AIC · ⊞ 20.1K
Comment /review to run again
There was a problem hiding this comment.
🟡 Changes recommended
Existing publish tests cover only the JS module manifest, leaving compressed-asset filtering across normal and --no-build publishes without regression coverage for exclusions, retained originals, and required controls.
1 open issue
What changed in this PR
This PR addresses #70394 by filtering precompressed Razor Class Library assets from the Blazor Hybrid publish pipeline, where WebView serves uncompressed files.
Changes:
- Adds a target to remove Alternative
.gzand.brstatic web assets whenCompressionEnabled=false. - Hooks the filter before publish manifest generation, asset resolution, and Brotli compression, while preserving Primary assets.
| File | Description |
|---|---|
src/Components/WebView/WebView/src/StaticWebAssets.Groups.targets |
Adds conditional filtering of precompressed assets before publish processing. |
Review effort: Balanced
|
The G/S/O local panel completed review of commit Informational discarded checks: The Alternative-role predicate preserves ordinary Primary Posted for informational purposes so the author can confirm the verifier didn't discard or leave unresolved a real finding; this item does not block Untested coverage: The packed WebView/NuGet-packaged RCL path and Validation boundary: G/S were frozen-source-only; O ran base/head normal and Human-directed and GitHub Copilot-generated. |
| still reach the publish pipeline and are copied next to the uncompressed files. | ||
| Drop them before the publish manifest and the Brotli publish pass run. --> | ||
| <Target Name="_RemoveBlazorWebViewPrecompressedAssets" | ||
| BeforeTargets="GenerateStaticWebAssetsPublishManifest;ResolvePublishStaticWebAssets;GeneratePublishCompressedStaticWebAssets" |
There was a problem hiding this comment.
Could this filtering be implemented in the shared StaticWebAssets SDK instead of only the WebView targets? With the .NET 11 SDK, a Blazor WebAssembly app with a project-referenced RCL still imports the RCL's compressed alternatives when CompressionEnabled=false; publish then contains gzip and Brotli copies. In my NuGet RCL sample, the package contained uncompressed assets and the consuming app owned compression, so it was already clean. This target addresses the Hybrid publish case but leaves the project-reference leak in other StaticWebAssets scenarios.
The shared SDK already has build and publish resolution hooks in Microsoft.NET.Sdk.StaticWebAssets.targets (publish hook). We could filter Alternative assets with the Content-Encoding trait, which the compression task assigns, and remove their endpoints using the existing filtering pattern. Build and publish need separate target names because publish runs build in the same MSBuild session. A prototype at these hooks removed the project-reference alternatives and published compressed files in the tested sample, while leaving compression-enabled output unchanged.
Note
This comment was generated with the assistance of GitHub Copilot.

Description
Blazor Hybrid sets
CompressionEnabled=falsein this package's targets, but referenced RCLs still contribute precompressed.gz/.brcopies of their assets asAssetRole="Alternative"static web assets. Those items reach the publish pipeline and are copied next to the uncompressed assets underpublish/wwwroot/_content/<Rcl>/.Remove Alternative
.gz/.brassets from@(StaticWebAsset)before the publish manifest, the publish asset resolution and the Brotli publish pass, but only whileCompressionEnabledis false. The assets are not used byWebViewManager, which serves the uncompressed files without HTTP content-encoding negotiation.Validation
This is an MSBuild target change. I could not run a MAUI/WPF Hybrid publish in this environment; CI will exercise the template builds. The condition is limited to
CompressionEnabled=false, which is set for all Blazor Hybrid consumers.Fixes #70394