|
| 1 | +## About |
| 2 | + |
| 3 | +`Microsoft.AspNetCore.Components.WebAssembly.Server` provides runtime server features for ASP.NET Core Blazor applications that have a client running under WebAssembly. |
| 4 | + |
| 5 | +## Key Features |
| 6 | + |
| 7 | +* Provides the ability to statically render components that utilize WebAssembly interactivity |
| 8 | +* Enables debugging functionality for code running in WebAssembly |
| 9 | +* Allows serialization and transmission of server-side authentication state for use during WebAssembly interactivity |
| 10 | + |
| 11 | +## How to Use |
| 12 | + |
| 13 | +To use `Microsoft.AspNetCore.Components.WebAssembly.Server`, follow these steps: |
| 14 | + |
| 15 | +### Installation |
| 16 | + |
| 17 | +```shell |
| 18 | +dotnet add package Microsoft.AspNetCore.Components.WebAssembly.Server |
| 19 | +``` |
| 20 | + |
| 21 | +### Configuration |
| 22 | + |
| 23 | +To enable WebAssembly interactivity in a Blazor Web app, configure it in your app's `Program.cs`: |
| 24 | + |
| 25 | +```csharp |
| 26 | +builder.Services.AddRazorComponents() |
| 27 | + .AddInteractiveWebAssemblyComponents(); |
| 28 | + |
| 29 | +var app = builder.Build(); |
| 30 | + |
| 31 | +if (app.Environment.IsDevelopment()) |
| 32 | +{ |
| 33 | + app.UseWebAssemblyDebugging(); |
| 34 | +} |
| 35 | + |
| 36 | +app.UseAntiforgery(); |
| 37 | +app.MapStaticAssets(); |
| 38 | +app.MapRazorComponents<App>() |
| 39 | + .AddInteractiveWebAssemblyRenderMode() |
| 40 | + .AddAdditionalAssemblies(typeof(BlazorWebApp.Client._Imports).Assembly); |
| 41 | +``` |
| 42 | + |
| 43 | +Make sure to update the call to `AddAdditionalAssemblies` with any client assemblies that should be included in the Blazor application. |
| 44 | + |
| 45 | +## Main Types |
| 46 | + |
| 47 | +The main types provided by this package are: |
| 48 | + |
| 49 | +* `WebAssemblyComponentsEndpointOptions`: Provides options for configuring interactive WebAssembly components |
| 50 | +* `AuthenticationStateSerializationOptions`: Provides options for configuring the JSON serialization of the `AuthenticationState` to the WebAssembly client |
| 51 | + |
| 52 | +## Additional Documentation |
| 53 | + |
| 54 | +For additional documentation and examples, refer to the [official documentation](https://learn.microsoft.com/aspnet/core/blazor) on Blazor. |
| 55 | + |
| 56 | +## Feedback & Contributing |
| 57 | + |
| 58 | +`Microsoft.AspNetCore.Components.WebAssembly.Server` is released as open-source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/aspnetcore). |
0 commit comments