overview
For the Server app of a hosted Blazor WASM solution, configure static file middleware by calling UseStaticFiles
in the request processing pipeline.
static web asset base path
By default, publishing a Blazor WASM app publishes the app’s static assets at the root path of the published output. This is configurable with <StaticWebAssetBasePath>
:
project.csproj
<PropertyGroup>
<StaticWebAssetBasePath>{PATH}</StaticWebAssetBasePath>
</PropertyGroup>
scenarios
client project of hosted blazor wasm app
<StaticWebAssetBasePath>
not set- Client app is published at
/BlazorHostedSample/Server/bin/Release/{TFM}/publish/wwwroot/
- Client app is published at
<StaticWebAssetBasePath>
set toapp1
- Client app is published at
/BlazorHostedSample/Server/bin/Release/{TFM}/publish/wwwroot/app1/
- Client app is published at
standalone blazor wasm app
<StaticWebAssetBasePath>
not set- App is published at
/BlazorStandaloneSample/bin/Release/{TFM}/publish/wwwroot/
- App is published at
<StaticWebAssetBasePath>
set toapp1
- App is published at
/BlazorStandaloneSample/bin/Release/{TFM}/publish/wwwroot/app1/
- App is published at