Summary
Update the .NET 10 Blazor Server Store app to use MapStaticAssets instead of UseStaticFiles to get build-time compression, fingerprinting, and improved caching behavior. Consider short-circuiting the pipeline for matched static assets.
Why
Microsoft Learn recommends MapStaticAssets (.NET 9+) for optimized static asset delivery (compression for JS/CSS, fingerprinting, content-based ETags, and cache headers). It can also short-circuit the middleware pipeline for static asset requests.
Guidance (docs)
Acceptance criteria
Store uses app.MapStaticAssets() in Program.cs (or equivalent) for static asset delivery.
- Static asset requests can be configured with
.ShortCircuit() where appropriate.
- Verify the app still serves framework/static assets correctly in Development and Production.
Notes
- If the app serves any assets added post-deployment or from non-build locations, retain/augment
UseStaticFiles only for those scenarios.
Summary
Update the .NET 10 Blazor Server
Storeapp to useMapStaticAssetsinstead ofUseStaticFilesto get build-time compression, fingerprinting, and improved caching behavior. Consider short-circuiting the pipeline for matched static assets.Why
Microsoft Learn recommends
MapStaticAssets(.NET 9+) for optimized static asset delivery (compression for JS/CSS, fingerprinting, content-basedETags, and cache headers). It can also short-circuit the middleware pipeline for static asset requests.Guidance (docs)
Acceptance criteria
Storeusesapp.MapStaticAssets()inProgram.cs(or equivalent) for static asset delivery..ShortCircuit()where appropriate.Notes
UseStaticFilesonly for those scenarios.