diff --git a/aspnetcore/blazor/fundamentals/environments.md b/aspnetcore/blazor/fundamentals/environments.md index 11c6dc2301b6..57676914bb81 100644 --- a/aspnetcore/blazor/fundamentals/environments.md +++ b/aspnetcore/blazor/fundamentals/environments.md @@ -71,6 +71,29 @@ For more information on how to configure the server-side environment, see + +``` + +Standalone Blazor WebAssembly: + +:::moniker-end + ```html + +``` + +Blazor Server: + +:::moniker-end ```html @@ -691,10 +712,31 @@ Example 1: Set the log In the preceding example, the `{BLAZOR SCRIPT}` placeholder is the Blazor script path and file name. -Example 2: Set the log level with an integer value: +Example 2: Set the log level with an integer value. + +:::moniker range=">= aspnetcore-8.0" + +Blazor Web App: + +```html + + +``` + +Blazor Server: + +:::moniker-end ```html - + ``` +The following example for the `Pages/_Host.cshtml` file (Blazor Server, all versions except ASP.NET Core 6.0) or `Pages/_Layout.cshtml` file (Blazor Server, ASP.NET Core 6.0). + +Blazor Server: + +```html + + +``` + In the preceding example, the `{BLAZOR SCRIPT}` placeholder is the Blazor script path and file name. When creating a hub connection in a component, set the (default: 30 seconds) and (default: 15 seconds) on the . Set the (default: 15 seconds) on the built . The following example shows the assignment of default values: @@ -843,6 +861,28 @@ To modify the connection events, register callbacks for the following connection **Both `onConnectionDown` and `onConnectionUp` must be specified.** +:::moniker range=">= aspnetcore-8.0" + +Blazor Web App: + +```html + + +``` + +Blazor Server: + +:::moniker-end + ```html + +``` + +Blazor Server: + +:::moniker-end + ```html + +``` -To manually start Blazor: +Blazor Server: + +:::moniker-end * Add an `autostart="false"` attribute and value to the Blazor ` + +``` + +Standalone Blazor WebAssembly: + +:::moniker-end + ```html + +``` + +Standalone Blazor WebAssembly: + +:::moniker-end + ```html + +``` + +Standalone Blazor WebAssembly: + ```html diff --git a/aspnetcore/blazor/globalization-localization.md b/aspnetcore/blazor/globalization-localization.md index e98cd4bec49c..3da6548b0a86 100644 --- a/aspnetcore/blazor/globalization-localization.md +++ b/aspnetcore/blazor/globalization-localization.md @@ -261,23 +261,41 @@ By default, the Intermediate Language (IL) Linker configuration for client-side The app's culture can be set in JavaScript when Blazor starts with the `applicationCulture` Blazor start option. The following example configures the app to launch using the United States English (`en-US`) culture. -* Prevent Blazor autostart by adding `autostart="false"` to Blazor's script tag: +Prevent Blazor autostart by adding `autostart="false"` to Blazor's script tag: - ```html - - ``` +```html + +``` + +In the preceding example, the `{BLAZOR SCRIPT}` placeholder is the Blazor script path and file name. + +Add the following ` - ``` + } + }); + +``` + +Standalone Blazor WebAssembly: + +:::moniker-end + +```html + +``` The value for `applicationCulture` must conform to the [BCP-47 language tag format](https://www.rfc-editor.org/info/bcp47). For more information on Blazor startup, see . diff --git a/aspnetcore/blazor/host-and-deploy/server.md b/aspnetcore/blazor/host-and-deploy/server.md index 5cb89cd10381..2492e792b17f 100644 --- a/aspnetcore/blazor/host-and-deploy/server.md +++ b/aspnetcore/blazor/host-and-deploy/server.md @@ -128,7 +128,23 @@ If a deployed app frequently displays the reconnection UI due to ping timeouts c > > In the following example, a custom value of 60 seconds is used for the server timeout. - In the [startup configuration](xref:blazor/fundamentals/startup) of a server-side Blazor app after the Blazor script (`blazor.*.js`) ` + ``` + + Blazor Server: ```html - ``` +```html + +``` - After Blazor's ` - ``` + } + } + }); + +``` + +Standalone Blazor WebAssembly: + +:::moniker-end - For more information on loading boot resources, see . +```html + +``` +For more information on loading boot resources, see . :::moniker range=">= aspnetcore-8.0" diff --git a/aspnetcore/blazor/project-structure.md b/aspnetcore/blazor/project-structure.md index e0d4e1719818..7809721fb4c0 100644 --- a/aspnetcore/blazor/project-structure.md +++ b/aspnetcore/blazor/project-structure.md @@ -539,6 +539,62 @@ The project structure of the client-side app in a hosted Blazor Webassembly solu :::moniker-end +## Location of the Blazor script + +The script is served from an embedded resource in the ASP.NET Core shared framework. + +:::moniker range=">= aspnetcore-8.0" + +In a Blazor Web App, the Blazor script is located in the `Components/App.razor` file: + +``` + +``` + +In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml` file: + +``` + +``` + +:::moniker-end + +:::moniker range=">= aspnetcore-7.0 < aspnetcore-8.0" + +In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml` file: + +``` + +``` + +:::moniker-end + +:::moniker range=">= aspnetcore-6.0 < aspnetcore-7.0" + +In a Blazor Server app, the Blazor script is located in the `Pages/_Layout.cshtml` file: + +``` + +``` + +:::moniker-end + +:::moniker range="< aspnetcore-6.0" + +In a Blazor Server app, the Blazor script is located in the `Pages/_Host.cshtml` file: + +``` + +``` + +:::moniker-end + +In a Blazor WebAssembly app, the Blazor script content is located in the `wwwroot/index.html` file: + +``` + +``` + ## Location of `` and `` content :::moniker range=">= aspnetcore-8.0" diff --git a/aspnetcore/migration/70-80.md b/aspnetcore/migration/70-80.md index bc2fc70de7a4..788404aa08e1 100644 --- a/aspnetcore/migration/70-80.md +++ b/aspnetcore/migration/70-80.md @@ -77,14 +77,29 @@ In the project file, update each [`Microsoft.AspNetCore.*`](https://www.nuget.or The following migration scenarios are covered: -* [Adopt Blazor Web App conventions](#adopt-blazor-web-app-conventions) +* [Update a Blazor Server app](#update-a-blazor-server-app) +* [Adopt all Blazor Web App conventions](#adopt-all-blazor-web-app-conventions) * [Convert a Blazor Server app into a Blazor Web App](#convert-a-blazor-server-app-into-a-blazor-web-app) +* [Update a Blazor WebAssembly app](#update-a-blazor-webassembly-app) * [Convert a hosted Blazor WebAssembly app into a Blazor Web App](#convert-a-hosted-blazor-webassembly-app-into-a-blazor-web-app) * [Update service and endpoint option configuration](#update-service-and-endpoint-option-configuration) For guidance on adding Blazor support to an ASP.NET Core app, see . -### Adopt Blazor Web App conventions +### Update a Blazor Server app + +We recommend using Blazor Web Apps in .NET 8, but Blazor Server is supported. To continue using Blazor Server with .NET 8, follow the guidance in the first three sections of this article: + +* [Update the .NET SDK version in `global.json`](#update-the-net-sdk-version-in-globaljson) +* [Update the target framework](#update-the-target-framework) +* [Update package references](#update-package-references) + +New Blazor features introduced for Blazor Web Apps aren't available to a Blazor Server app updated to run under .NET 8. If you wish to adopt the new .NET 8 Blazor features, follow the guidance in either of the following sections: + +* [Adopt all Blazor Web App conventions](#adopt-all-blazor-web-app-conventions) +* [Convert a Blazor Server app into a Blazor Web App](#convert-a-blazor-server-app-into-a-blazor-web-app) + +### Adopt all Blazor Web App conventions To optionally adopt all of the new Blazor Web App conventions, we recommend the following process: @@ -99,7 +114,7 @@ New .NET 8 features are covered in . When updating an Blazor Server apps are supported in .NET 8 without any code changes. Use the following guidance to convert a Blazor Server app into an equivalent .NET 8 Blazor Web App, which makes all of the [new .NET 8 features](xref:aspnetcore-8#blazor) available. > [!IMPORTANT] -> This section focuses on the minimal changes required to convert a .NET 7 Blazor Server app into a .NET 8 Blazor Web App. To adopt all of the new Blazor Web App conventions, follow the guidance in the [Adopt Blazor Web App conventions](#adopt-blazor-web-app-conventions) section. +> This section focuses on the minimal changes required to convert a .NET 7 Blazor Server app into a .NET 8 Blazor Web App. To adopt all of the new Blazor Web App conventions, follow the guidance in the [Adopt all Blazor Web App conventions](#adopt-all-blazor-web-app-conventions) section. 1. Follow the guidance in the first three sections of this article: @@ -274,12 +289,20 @@ Blazor Server apps are supported in .NET 8 without any code changes. Use the fol For more information, see . +### Update a Blazor WebAssembly app + +Follow the guidance in the first three sections of this article: + +* [Update the .NET SDK version in `global.json`](#update-the-net-sdk-version-in-globaljson) +* [Update the target framework](#update-the-target-framework) +* [Update package references](#update-package-references) + ### Convert a hosted Blazor WebAssembly app into a Blazor Web App Blazor WebAssembly apps are supported in .NET 8 without any code changes. Use the following guidance to convert an ASP.NET Core hosted Blazor WebAssembly app into an equivalent .NET 8 Blazor Web App, which makes all of the [new .NET 8 features](xref:aspnetcore-8#blazor) available. > [!IMPORTANT] -> This section focuses on the minimal changes required to convert a .NET 7 ASP.NET Core hosted Blazor WebAssembly app into a .NET 8 Blazor Web App. To adopt all of the new Blazor Web App conventions, follow the guidance in the [Adopt Blazor Web App conventions](#adopt-blazor-web-app-conventions) section. +> This section focuses on the minimal changes required to convert a .NET 7 ASP.NET Core hosted Blazor WebAssembly app into a .NET 8 Blazor Web App. To adopt all of the new Blazor Web App conventions, follow the guidance in the [Adopt all Blazor Web App conventions](#adopt-all-blazor-web-app-conventions) section. 1. Follow the guidance in the first three sections of this article: diff --git a/aspnetcore/release-notes/aspnetcore-8.0.md b/aspnetcore/release-notes/aspnetcore-8.0.md index c2eab708d3e1..937e4471a027 100644 --- a/aspnetcore/release-notes/aspnetcore-8.0.md +++ b/aspnetcore/release-notes/aspnetcore-8.0.md @@ -332,9 +332,23 @@ Blazor.start({ }); ``` -#### New approach for the JavaScript client of a Blazor Server app +#### New approach for the JavaScript client of server-side Blazor app -The following example shows the ***new approach*** for assigning values that are double the default values in ASP.NET Core 8.0 or later: +The following example shows the ***new approach*** for assigning values that are double the default values in ASP.NET Core 8.0 or later for Blazor Web Apps and Blazor Server. + +Blazor Web App: + +```javascript +Blazor.start({ + circuit: { + configureSignalR: function (builder) { + builder.withServerTimeout(60000).withKeepAliveInterval(30000); + } + } +}); +``` + +Blazor Server: ```javascript Blazor.start({ diff --git a/aspnetcore/tutorials/signalr-typescript-webpack.md b/aspnetcore/tutorials/signalr-typescript-webpack.md index 744bbc609e59..db93ad769208 100644 --- a/aspnetcore/tutorials/signalr-typescript-webpack.md +++ b/aspnetcore/tutorials/signalr-typescript-webpack.md @@ -11,7 +11,7 @@ uid: tutorials/signalr-typescript-webpack --- # Tutorial: Get started with ASP.NET Core SignalR using TypeScript and Webpack -By [Sébastien Sougnez](https://twitter.com/ssougnez) +By [Sébastien Sougnez](https://twitter.com/s_sougnez) [!INCLUDE[](~/includes/not-latest-version.md)]