Blazor Hybrid Windows publish still copies precompressed .gz and .br assets from referenced RCLs into publish/wwwroot

Aperta
#70,394 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
build-system

Direzione di ricerca

Start by tracing GeneratePublishCompressedStaticWebAssets and _PublishStaticWebAssetsPreserveNewest in the publish targets, then compare how the existing ConvertStaticWebAssetsToMauiAssets filtering handles AssetRole="Alternative" assets. Reproduce with a MAUI Blazor Hybrid app that references an RCL and inspect its published wwwroot/_content/<Rcl>/ directory. Done means publishing with CompressionEnabled=false leaves only the uncompressed RCL assets.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area-blazor bug
Description

Blazor Hybrid sets <CompressionEnabled>false</CompressionEnabled> (via Microsoft.AspNetCore.Components.WebView's StaticWebAssets.Groups.targets) because WebViewManager serves static assets locally without HTTP content-encoding negotiation. However, when a Blazor Hybrid app references a Razor class library (ProjectReference), the RCL still builds with CompressionEnabled=true by default and contributes precompressed .gz and .br (AssetRole="Alternative") static web assets to the consuming app's publish manifest.

While https://github.com/dotnet/maui/pull/33917 (for https://github.com/dotnet/maui/issues/33773) filtered AssetRole='Alternative' .gz/.br items out of @(MauiAsset) in ConvertStaticWebAssetsToMauiAssets (fixing Android APKs), it did not remove them from @(StaticWebAsset) / _PublishStaticWebAssetsPreserveNewest. As a result, publishing a Blazor Hybrid app on Windows (MAUI Windows, WPF, or WinForms) still runs GeneratePublishCompressedStaticWebAssets (Brotli) for the RCL and copies redundant .gz and .br files for every RCL asset into publish/wwwroot/_content/<Rcl>/.

Discovered during validation testing in https://github.com/dotnet/aspnetcore/issues/68814#issuecomment-5536899858.

Steps to Reproduce
  1. Create a new MAUI Blazor Hybrid app and a Razor Class Library from templates and reference the RCL:
    dotnet new maui-blazor -n MauiHybridApp
    dotnet new razorclasslib -n MyRcl
    dotnet add MauiHybridApp/MauiHybridApp.csproj reference MyRcl/MyRcl.csproj
    
  2. Publish the MAUI app for Windows:
    dotnet publish MauiHybridApp/MauiHybridApp.csproj -c Release -f net11.0-windows10.0.19041.0
    
  3. Inspect MauiHybridApp/bin/Release/net11.0-windows10.0.19041.0/win-x64/publish/wwwroot/_content/MyRcl/.
  4. Expected: Only uncompressed RCL assets (exampleJsInterop.js, MyRcl.<hash>.bundle.scp.css, background.png) are published when CompressionEnabled=false.
  5. Actual: Precompressed .gz and .br files (exampleJsInterop.js.gz, exampleJsInterop.js.br, MyRcl.<hash>.bundle.scp.css.gz, MyRcl.<hash>.bundle.scp.css.br) are also copied into publish/wwwroot/_content/MyRcl/.
Lingua principale
C#
Stelle
38.5k
Fork
11.6k
Merge medio
3g 1h
PR unite (30g)
289

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotnet/aspnetcore

Tutte le issue di dotnet/aspnetcore

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.