BlazorWasmPreRendering.Build
BlazorWasmPreRendering.Build copied to clipboard
Package not working with Hosting
Overview
This PR addresses an issue encountered when integrating the BlazorWasmPreRendering.Build package into an ASP.NET Core WebAPI project for creating a Blazor WASM Core Hosted app. While the package works as expected when publishing a standalone Blazor WASM app, the prerendering compilation step is skipped when referenced from an ASP.NET Core WebAPI project, causing it to fall back to a standard build.
Problem Description
-
Expected Behavior: When using
BlazorWasmPreRendering.Build, the prerendering compilation step should be executed during the build process, regardless of whether the Blazor WASM project is standalone or hosted within an ASP.NET Core WebAPI. - Observed Behavior: When the Blazor WASM project is integrated as part of a Core Hosted app (referenced by an ASP.NET Core WebAPI project), the prerendering compilation step is not triggered. This results in the application using the normal build process instead of the optimized prerendered build.
Reproduction
Just create a minimal project for the Blazor WASM + Core Hosted template in .net 9 and dotnet publish