Skip to content

Commit 64c15b7

Browse files
authored
Merge pull request #36123 from dotnet/main
2 parents d6dfe84 + 1f6c84e commit 64c15b7

File tree

104 files changed

+537
-115023
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+537
-115023
lines changed

aspnetcore/blazor/host-and-deploy/configure-trimmer.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ Consider the following example that performs JSON deserialization into a <xref:S
8383

8484
The preceding component executes normally when the app is run locally and produces the following rendered list:
8585

86-
> • 1:T1, 1:T2
86+
> • 1:T1, 1:T2
8787
> • 2:T2, 2:T2
8888
8989
When the app is published, <xref:System.Tuple%602> is trimmed from the app, even in spite of setting the `<PublishTrimmed>` property to `false` in the project file. Accessing the component throws the following exception:
9090

91-
> :::no-loc text="crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]":::
92-
> :::no-loc text="Unhandled exception rendering component: ConstructorContainsNullParameterNames, System.Tuple`2[System.String,System.String]":::
91+
> :::no-loc text="crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]":::
92+
> :::no-loc text="Unhandled exception rendering component: ConstructorContainsNullParameterNames, System.Tuple`2[System.String,System.String]":::
9393
> :::no-loc text="System.NotSupportedException: ConstructorContainsNullParameterNames, System.Tuple`2[System.String,System.String]":::
9494
9595
To address lost types, consider adopting one of the following approaches.
9696

9797
### Custom types
9898

99-
Custom types aren't trimmed by Blazor when an app is published, so we recommend using custom types for JS interop, JSON serialization/deserialization, and other operations that rely on reflection.
99+
Custom types aren't trimmed by Blazor when an app is published (unless explicitly opted in), so we recommend using custom types for JS interop, JSON serialization/deserialization, and other operations that rely on reflection.
100100

101101
The following modifications create a `StringTuple` type for use by the component.
102102

@@ -123,7 +123,7 @@ The component is modified to use the `StringTuple` type:
123123
+ items = JsonSerializer.Deserialize<List<StringTuple>>(data, options)!;
124124
```
125125

126-
Because custom types are never trimmed by Blazor when an app is published, the component works as designed after the app is published.
126+
Because custom types aren't trimmed by Blazor when an app is published (unless explicitly opted in), the component works as designed after the app is published.
127127

128128
:::moniker range=">= aspnetcore-10.0"
129129

aspnetcore/blazor/host-and-deploy/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ Demonstration sample apps for Blazor WebAssembly in a React app (`BlazorWebAssem
137137

138138
:::moniker-end
139139

140+
:::moniker range=">= aspnetcore-8.0"
141+
142+
## Aspects of Blazor WebAssembly caching apply to Blazor Web Apps
143+
144+
Blazor bundle caching and HTTP caching guidance in the *Blazor WebAssembly* node focus on standalone Blazor WebAssembly apps, but several aspects of client-side caching in these articles also apply to Blazor Web Apps that adopt Interactive WebAssembly or Interactive Auto render modes. If a Blazor Web App that renders content client-side encounters a static asset or bundle caching problem, see the guidance in these articles to troubleshoot the problem:
145+
146+
* <xref:blazor/host-and-deploy/webassembly/bundle-caching-and-integrity-check-failures>
147+
* <xref:blazor/host-and-deploy/webassembly/http-caching-issues>
148+
149+
:::moniker-end
150+
140151
## Blazor Server `MapFallbackToPage` configuration
141152

142153
*This section only applies to Blazor Server apps. <xref:Microsoft.AspNetCore.Builder.RazorPagesEndpointRouteBuilderExtensions.MapFallbackToPage%2A> isn't supported in Blazor Web Apps and Blazor WebAssembly apps.*

aspnetcore/blazor/host-and-deploy/webassembly/http-caching-issues.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ While future Blazor releases might provide better solutions for dealing with HTT
2121
Common problems that negatively impact the user upgrade experience include:
2222

2323
* **Incorrect handling of project and package updates**: This happens if you don't update all of the app's deployed projects to use the same major framework version or if you use packages from a previous version when a newer version is available as part of the major upgrade.
24-
* **Incorrect configuration of caching headers**: HTTP caching headers control how, where, and for how long the app's responses are cached. If headers aren't configured correctly, users might receive stale content.
24+
* **Incorrect configuration of caching headers**: HTTP caching headers control how, where, and for how long the app's responses are cached. If headers aren't configured correctly, users might receive stale or mismatched files. This includes [Blazor bundle assets caching](xref:blazor/host-and-deploy/webassembly/bundle-caching-and-integrity-check-failures), where server caching headers must be properly set to avoid caching problems on the client.
2525
* **Incorrect configuration of other layers**: Content Delivery Networks (CDNs) and other layers of the deployed app can cause issues if incorrectly configured. For example, CDNs are designed to cache and deliver content to improve performance and reduce latency. If a CDN is incorrectly serving cached versions of assets, it can lead to stale content delivery to the user.
2626

2727
## Detect and diagnose upgrade issues
@@ -42,7 +42,7 @@ Ensure that framework packages line up with the framework version. Using package
4242

4343
### Verify the presence of correct caching headers
4444

45-
The correct caching headers should be present on responses to resource requests. This includes `ETag`, `Cache-Control`, and other caching headers. The configuration of these headers is dependent on the hosting service or hosting server platform. They are particularly important for assets such as the Blazor script (`blazor.webassembly.js`) and anything the script downloads.
45+
The correct caching headers should be present on responses to resource requests. This includes `ETag`, `Cache-Control`, and other caching headers. The configuration of these headers is dependent on the hosting service or hosting server platform. They are particularly important for assets such as the [Blazor script](xref:blazor/project-structure#location-of-the-blazor-script) and anything the script downloads.
4646

4747
Incorrect HTTP caching headers may also impact service workers. Service workers rely on caching headers to manage cached resources effectively. Therefore, incorrect or missing headers can disrupt the service worker's functionality.
4848

aspnetcore/blazor/hybrid/tutorials/maui-blazor-web-app.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to build a .NET MAUI Blazor Hybrid app with a Blazor Web
55
monikerRange: '>= aspnetcore-8.0'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 11/12/2024
8+
ms.date: 09/17/2025
99
uid: blazor/hybrid/tutorials/maui-blazor-web-app
1010
---
1111
# Build a .NET MAUI Blazor Hybrid app with a Blazor Web App
@@ -30,18 +30,24 @@ If you haven't already installed the .NET MAUI workload, install it now. The .NE
3030
dotnet workload install maui
3131
```
3232

33-
Create a solution from the project template with the following .NET CLI command:
33+
Create a solution from the project template with the following .NET CLI command, replacing the `{INTERACTIVITY}` placeholder with the Blazor render mode that you desire to use:
34+
35+
* `Server`: Adopts the Interactive Server render mode and produces a single-project Blazor app.
36+
* `WebAssembly`: Adopts the Interactive WebAssembly render mode and produces two Blazor projects, a server project and a `.Client` project.
37+
* `Auto`: Adopts the Interactive Auto render mode and produces two Blazor projects, a server project and a `.Client` project.
38+
39+
For more information on the preceding render modes and the projects produced, see <xref:blazor/components/render-modes#render-modes> and the [Use Blazor render modes](#use-blazor-render-modes) section later in this article.
3440

3541
```dotnetcli
36-
dotnet new maui-blazor-web -o MauiBlazorWeb -I Server
42+
dotnet new maui-blazor-web -o MauiBlazorWeb -I {INTERACTIVITY}
3743
```
3844

3945
In the preceding command:
4046

4147
* The `-o|--output` option creates a new folder for the app named `MauiBlazorWeb`.
42-
* The `-I|--InteractivityPlatform` option sets the interactivity render mode to Interactive Server (`InteractiveServer`). All three interactive Blazor render modes (`Server`, `WebAssembly`, and `Auto`) are supported by the project template. For more information, see the [Use Blazor render modes](#use-blazor-render-modes) section.
48+
* The `-I|--InteractivityPlatform` option sets the interactivity render mode. The `{INTERACTIVITY}` placeholder is the interactive Blazor render mode. All three interactive Blazor render modes (`Server`, `WebAssembly`, and `Auto`) are supported by the project template. For more information, see <xref:blazor/components/render-modes#render-modes> and the [Use Blazor render modes](#use-blazor-render-modes) section.
4349

44-
The app automatically adopts global interactivity, which is important because MAUI apps always run interactively and throw errors on Razor component pages that explicitly specify a render mode. For more information, see [BlazorWebView needs a way to enable overriding ResolveComponentForRenderMode (`dotnet/aspnetcore` #51235)](https://github.com/dotnet/aspnetcore/issues/51235).
50+
The preceding command produces a Blazor app that adopts global interactivity, which is important because MAUI apps always run interactively and throw errors on Razor component pages that explicitly specify a render mode. For more information, see [BlazorWebView needs a way to enable overriding ResolveComponentForRenderMode (`dotnet/aspnetcore` #51235)](https://github.com/dotnet/aspnetcore/issues/51235).
4551

4652
:::moniker-end
4753

0 commit comments

Comments
 (0)