Skip to content

Commit 722aa51

Browse files
committed
Further work on standalone WASM environments
1 parent 9ef9950 commit 722aa51

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

aspnetcore/blazor/fundamentals/environments.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,28 @@ On the client for a Blazor Web App, the environment is determined from the serve
3838
<!--Blazor-WebAssembly:{"environmentName":"Development", ...}-->
3939
```
4040

41-
For a standalone Blazor WebAssembly app, set the environment with the `<WasmApplicationEnvironmentName>` property in the app's project file (`.csproj`). The following example sets the `Staging` environment:
41+
For a standalone Blazor WebAssembly app, set the environment with the `<WasmApplicationEnvironmentName>` MSBuild property in the app's project file (`.csproj`). The following example sets the `Staging` environment:
4242

4343
```xml
4444
<WasmApplicationEnvironmentName>Staging</WasmApplicationEnvironmentName>
4545
```
4646

4747
The default environments are `Development` for build and `Production` for publish.
4848

49+
The environment value for `<WasmApplicationEnvironmentName>` can be set during publish. For example, you can set the value based on the app's configuration in Visual Studio:
50+
51+
```xml
52+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
53+
<WasmApplicationEnvironmentName>Development</WasmApplicationEnvironmentName>
54+
</PropertyGroup>
55+
56+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
57+
<WasmApplicationEnvironmentName>Production</WasmApplicationEnvironmentName>
58+
</PropertyGroup>
59+
```
60+
61+
Another alternative is to create a custom server-side web API endpoint. The standalone Blazor WebAssembly app requests its environment from the web API either at app startup or on-demand while it's running. For general information on calling a web API from a Blazor app, see <xref:blazor/call-web-api>.
62+
4963
:::moniker-end
5064

5165
:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0"

aspnetcore/release-notes/aspnetcore-10/includes/blazor.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ The default environments are:
207207
* `Development` for build.
208208
* `Production` for publish.
209209

210+
For more information, see <xref:blazor/fundamentals/environments#set-the-environment>.
211+
210212
### Boot configuration file inlined
211213

212214
Blazor's boot configuration, which prior to the release of .NET 10 existed in a file named `blazor.boot.json`, has been inlined into the `dotnet.js` script. This only affects developers who are interacting directly with the `blazor.boot.json` file, such as when developers are:

0 commit comments

Comments
 (0)