From 0e3c580ea3aaa12faf4851bfbd7c3ae37f6783cc Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 07:08:25 -0500
Subject: [PATCH 01/13] Blazor prerendering and integration updates
---
.../prerendering-and-integration.md | 31 +++++++------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index 0ffa7c1ebd43..2986f30f10f9 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -279,22 +279,18 @@ An existing Razor Pages or MVC app can integrate Razor components into pages and
* Add the following `` tag to the `
` element in `Pages/Shared/_Layout.cshtml` (Razor Pages) or `Views/Shared/_Layout.cshtml` (MVC):
- ```diff
- +
+ ```html
+
```
The `href` value (the *app base path*) in the preceding example assumes that the app resides at the root URL path (`/`). If the app is a sub-application, follow the guidance in the *App base path* section of the article.
- * Add a `
-
- @await RenderSectionAsync("Scripts", required: false)
-
+ ```html
+
```
The framework adds the `blazor.server.js` script to the app. There's no need to manually add a `blazor.server.js` script file to the app.
@@ -310,24 +306,21 @@ An existing Razor Pages or MVC app can integrate Razor components into pages and
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
+ @using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using {APP NAMESPACE}
```
-1. Register the Blazor Server service in `Startup.ConfigureServices`.
+1. Register the Blazor Server service in `Program.cs` where services are registered:
- `Startup.cs`:
-
- ```diff
- + services.AddServerSideBlazor();
+ ```csharp
+ builder.Services.AddServerSideBlazor();
```
-1. Add the Blazor Hub endpoint to the endpoints (`app.UseEndpoints`) of `Startup.Configure`.
-
- `Startup.cs`:
+1. Add the Blazor Hub endpoint to the endpoints of `Program.cs` where routes are mapped:
- ```diff
- + endpoints.MapBlazorHub();
+ ```csharp
+ app.MapBlazorHub();
```
1. Integrate components into any page or view. For example, add a `Counter` component to the project's `Shared` folder.
From cd727b99ed9de1c8505a5949a0ae10b64c6d222e Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 07:48:14 -0500
Subject: [PATCH 02/13] Updates
---
.../prerendering-and-integration.md | 31 +++++++++----------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index 2986f30f10f9..9052902f4d81 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -317,7 +317,9 @@ An existing Razor Pages or MVC app can integrate Razor components into pages and
builder.Services.AddServerSideBlazor();
```
-1. Add the Blazor Hub endpoint to the endpoints of `Program.cs` where routes are mapped:
+1. Add the Blazor Hub endpoint to the endpoints of `Program.cs` where routes are mapped.
+
+ Place the following line after the call to `MapRazorPages` (Razor Pages) or `MapControllerRoute` (MVC):
```csharp
app.MapBlazorHub();
@@ -399,13 +401,13 @@ To support routable Razor components in Razor Pages apps:
```razor
@using Microsoft.AspNetCore.Components.Routing
-
+
-
+
-
Page not found
-
Sorry, but there's nothing here!
+ Not found
+
Sorry, there's nothing at this address.
```
@@ -416,16 +418,16 @@ To support routable Razor components in Razor Pages apps:
```cshtml
@page "/blazor"
+ @namespace {APP NAMESPACE}.Pages.Shared
+ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}
-
-
-
+
```
- Components use the shared `_Layout.cshtml` file for their layout.
+ In this scenario, components use the shared `_Layout.cshtml` file for their layout.
configures whether the `App` component:
@@ -434,15 +436,10 @@ To support routable Razor components in Razor Pages apps:
For more information on the Component Tag Helper, including passing parameters and configuration, see .
-1. In the `Startup.Configure` endpoints of `Startup.cs`, add a low-priority route for the `_Host` page as the last endpoint:
+1. In the `Program.cs` endpoints, add a low-priority route for the `_Host` page as the last endpoint:
- ```diff
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapRazorPages();
- endpoints.MapBlazorHub();
- + endpoints.MapFallbackToPage("/_Host");
- });
+ ```csharp
+ app.MapFallbackToPage("/_Host");
```
1. Add routable components to the project.
From 4c70ba90451d559deaf539babb3f5d44a324ed1f Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 08:00:58 -0500
Subject: [PATCH 03/13] Updates
---
.../prerendering-and-integration.md | 29 +++++++------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index 9052902f4d81..f851ef5af6cc 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -484,13 +484,13 @@ To support routable Razor components in MVC apps:
```razor
@using Microsoft.AspNetCore.Components.Routing
-
+
-
+
-
Page not found
-
Sorry, but there's nothing here!
+ Not found
+
Sorry, there's nothing at this address.
```
@@ -500,13 +500,13 @@ To support routable Razor components in MVC apps:
`Views/Home/_Host.cshtml`:
```cshtml
+ @namespace {APP NAMESPACE}.Views.Shared
+ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}
-
-
-
+
```
Components use the shared `_Layout.cshtml` file for their layout.
@@ -529,20 +529,13 @@ To support routable Razor components in MVC apps:
}
```
-1. In the `Startup.Configure` endpoints of `Startup.cs`, add a low-priority route for the controller action that returns the `_Host` view:
+1. In the `Program.cs` endpoints, add a low-priority route for the controller action that returns the `_Host` view:
- ```diff
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllerRoute(
- name: "default",
- pattern: "{controller=Home}/{action=Index}/{id?}");
- endpoints.MapBlazorHub();
- + endpoints.MapFallbackToController("Blazor", "Home");
- });
+ ```csharp
+ app.MapFallbackToController("Blazor", "Home");
```
-1. Add routable components to the project.
+1. Create a `Pages` folder in the MVC app and add routable components.
`Pages/RoutableCounter.razor`:
From aa06bc5aec81185ce50e0e71bac15a4faba06cd4 Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 08:42:15 -0500
Subject: [PATCH 04/13] Updates
---
.../components/prerendering-and-integration.md | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index f851ef5af6cc..3e9aeeeacf3c 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -33,7 +33,7 @@ To set up prerendering for a hosted Blazor WebAssembly app:
1. **Delete** the `wwwroot/index.html` file from the Blazor WebAssembly **`Client`** project.
-1. In the **`Client`** project, **delete** the following line in `Program.Main` (`Program.cs`):
+1. In the **`Client`** project, **delete** the following line in `Program.cs`:
```diff
- builder.RootComponents.Add("#app");
@@ -41,12 +41,13 @@ To set up prerendering for a hosted Blazor WebAssembly app:
1. Add `_Host.cshtml` and `_Layout.cshtml` files to the **`Server`** project's `Pages` folder. You can obtain `_Host.cshtml` and `_Layout.cshtml` files from a project created from the Blazor Server template with the `dotnet new blazorserver -o BlazorServer` command in a command shell (the `-o BlazorServer` option creates a folder for the project). After placing the files into the **`Server`** project's `Pages` folder, make the following changes to the `_Layout.cshtml` file:
+ * Update the `Pages` namespace (for example, `@namespace BlazorHosted.Pages`).
* Provide an [`@using`](xref:mvc/views/razor#using) directive for the **`Client`** project (for example, `@using BlazorHosted.Client`).
* Update the stylesheet links to point to the WebAssembly project's stylesheets. In the following example, the client project's namespace is `BlazorHosted.Client`:
```diff
-
- -
+ -
+
+
```
@@ -68,13 +69,11 @@ To set up prerendering for a hosted Blazor WebAssembly app:
+
```
-1. In `Startup.Configure` of the **`Server`** project, change the fallback from the `index.html` file to the `_Host.cshtml` page.
-
- `Startup.cs`:
+1. In endpoint mapping of the **`Server`** project in `Program.cs`, change the fallback from the `index.html` file to the `_Host.cshtml` page:
```diff
- - endpoints.MapFallbackToFile("index.html");
- + endpoints.MapFallbackToPage("/_Host");
+ - app.MapFallbackToFile("index.html");
+ + app.MapFallbackToPage("/_Host");
```
1. Run the **`Server`** project. The hosted Blazor WebAssembly app is prerendered by the **`Server`** project for clients.
From 49e41d7b643f1a710c7fd42d248424eeea8b3e9a Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 08:46:58 -0500
Subject: [PATCH 05/13] Updates
---
.../blazor/components/prerendering-and-integration.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index 3e9aeeeacf3c..f54aa2413904 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -69,6 +69,13 @@ To set up prerendering for a hosted Blazor WebAssembly app:
+
```
+ * In the `_Host.cshtml` file, change the `{APP NAMESPACE}.Pages` namespace, if it exists, to that of the **`Client`** project. If a namespace of `{APP NAMESPACE}.Pages` doesn't exist, add the namespace for the **`Client`** project:
+
+ ```diff
+ - @namespace {APP NAMESPACE}.Pages
+ + @namespace BlazorHosted.Client
+ ```
+
1. In endpoint mapping of the **`Server`** project in `Program.cs`, change the fallback from the `index.html` file to the `_Host.cshtml` page:
```diff
From 3bd3bf0211efda93d4e79b53b4ddbeac44c69ccc Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 11:38:22 -0500
Subject: [PATCH 06/13] Updates
---
.../blazor/components/prerendering-and-integration.md | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index f54aa2413904..42c0f2b8e7ab 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -41,15 +41,18 @@ To set up prerendering for a hosted Blazor WebAssembly app:
1. Add `_Host.cshtml` and `_Layout.cshtml` files to the **`Server`** project's `Pages` folder. You can obtain `_Host.cshtml` and `_Layout.cshtml` files from a project created from the Blazor Server template with the `dotnet new blazorserver -o BlazorServer` command in a command shell (the `-o BlazorServer` option creates a folder for the project). After placing the files into the **`Server`** project's `Pages` folder, make the following changes to the `_Layout.cshtml` file:
- * Update the `Pages` namespace (for example, `@namespace BlazorHosted.Pages`).
+ * Update the `Pages` namespace at the top of the file (for example, `@namespace {APP NAMESPACE}.Pages`) to match the namespace of the **`Server`** app's pages (for example, `@namespace BlazorHosted.Server.Pages`). The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Layout.cshtml` file.
* Provide an [`@using`](xref:mvc/views/razor#using) directive for the **`Client`** project (for example, `@using BlazorHosted.Client`).
- * Update the stylesheet links to point to the WebAssembly project's stylesheets. In the following example, the client project's namespace is `BlazorHosted.Client`:
+ * Update the stylesheet links to point to the WebAssembly project's stylesheets. In the following example, the client project's namespace is `BlazorHosted.Client`. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Layout.cshtml` file.
+ * Update the `render-mode` of the Component Tag Helper (`` tag) for the `HeadOutlet` component to `WebAssemblyPrerendered`.
```diff
-
-
+ -
+
+
+ +
```
> [!NOTE]
@@ -69,7 +72,7 @@ To set up prerendering for a hosted Blazor WebAssembly app:
+
```
- * In the `_Host.cshtml` file, change the `{APP NAMESPACE}.Pages` namespace, if it exists, to that of the **`Client`** project. If a namespace of `{APP NAMESPACE}.Pages` doesn't exist, add the namespace for the **`Client`** project:
+ * In the `_Host.cshtml` file, change the `{APP NAMESPACE}.Pages` namespace, if it exists, to that of the **`Client`** project. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Host.cshtml` file. If a namespace for `{APP NAMESPACE}.Pages` doesn't exist, add the namespace for the **`Client`** project (for example, `BlazorHosted.Client`):
```diff
- @namespace {APP NAMESPACE}.Pages
From d94469d1dff3cb742604a897a6f48b27a2dda241 Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 11:51:21 -0500
Subject: [PATCH 07/13] Updates
---
.../prerendering-and-integration.md | 38 +++++++++++++------
1 file changed, 26 insertions(+), 12 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index 42c0f2b8e7ab..d52f2249ab9b 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -39,12 +39,24 @@ To set up prerendering for a hosted Blazor WebAssembly app:
- builder.RootComponents.Add("#app");
```
-1. Add `_Host.cshtml` and `_Layout.cshtml` files to the **`Server`** project's `Pages` folder. You can obtain `_Host.cshtml` and `_Layout.cshtml` files from a project created from the Blazor Server template with the `dotnet new blazorserver -o BlazorServer` command in a command shell (the `-o BlazorServer` option creates a folder for the project). After placing the files into the **`Server`** project's `Pages` folder, make the following changes to the `_Layout.cshtml` file:
+1. Add `_Host.cshtml` and `_Layout.cshtml` files to the **`Server`** project's `Pages` folder. You can obtain `_Host.cshtml` and `_Layout.cshtml` files from a project created from the Blazor Server template with the `dotnet new blazorserver -o BlazorServer` command in a command shell (the `-o BlazorServer` option creates a folder for the project). After placing the files into the **`Server`** project's `Pages` folder:
- * Update the `Pages` namespace at the top of the file (for example, `@namespace {APP NAMESPACE}.Pages`) to match the namespace of the **`Server`** app's pages (for example, `@namespace BlazorHosted.Server.Pages`). The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Layout.cshtml` file.
- * Provide an [`@using`](xref:mvc/views/razor#using) directive for the **`Client`** project (for example, `@using BlazorHosted.Client`).
- * Update the stylesheet links to point to the WebAssembly project's stylesheets. In the following example, the client project's namespace is `BlazorHosted.Client`. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Layout.cshtml` file.
- * Update the `render-mode` of the Component Tag Helper (`` tag) for the `HeadOutlet` component to `WebAssemblyPrerendered`.
+ Make the following changes to the `_Layout.cshtml` file:
+
+ * Update the `Pages` namespace at the top of the file to match the namespace of the **`Server`** app's pages. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app's pages that provided the `_Layout.cshtml` file:
+
+ ```diff
+ - @namespace {APP NAMESPACE}.Pages
+ + @namespace BlazorHosted.Server.Pages
+ ```
+
+ * Add an [`@using`](xref:mvc/views/razor#using) directive for the **`Client`** project at the top of the file:
+
+ ```diff
+ + @using BlazorHosted.Client
+ ```
+
+ * Update the stylesheet links to point to the WebAssembly project's stylesheets. In the following example, the client project's namespace is `BlazorHosted.Client`. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Layout.cshtml` file. Update the `render-mode` of the Component Tag Helper (`` tag) for the `HeadOutlet` component to `WebAssemblyPrerendered`.
```diff
-
@@ -58,25 +70,27 @@ To set up prerendering for a hosted Blazor WebAssembly app:
> [!NOTE]
> Leave the `` element that requests the Bootstrap stylesheet (`css/bootstrap/bootstrap.min.css`) in place.
- * In the `_Layout.cshtml` file, update the Blazor script source to use the client-side Blazor WebAssembly script:
+ * Update the Blazor script source to use the client-side Blazor WebAssembly script:
```diff
-
+
```
- * In the `_Host.cshtml` file, update the `render-mode` of the [Component Tag Helper](xref:mvc/views/tag-helpers/builtin-th/component-tag-helper) to prerender the root `App` component with :
+ In the `_Host.cshtml` file:
+
+ * Change the `Pages` namespace to that of the **`Client`** project. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app's pages that provided the `_Host.cshtml` file:
```diff
- -
- +
+ - @namespace {APP NAMESPACE}.Pages
+ + @namespace BlazorHosted.Client
```
- * In the `_Host.cshtml` file, change the `{APP NAMESPACE}.Pages` namespace, if it exists, to that of the **`Client`** project. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Host.cshtml` file. If a namespace for `{APP NAMESPACE}.Pages` doesn't exist, add the namespace for the **`Client`** project (for example, `BlazorHosted.Client`):
+ * Update the `render-mode` of the [Component Tag Helper](xref:mvc/views/tag-helpers/builtin-th/component-tag-helper) to prerender the root `App` component with :
```diff
- - @namespace {APP NAMESPACE}.Pages
- + @namespace BlazorHosted.Client
+ -
+ +
```
1. In endpoint mapping of the **`Server`** project in `Program.cs`, change the fallback from the `index.html` file to the `_Host.cshtml` page:
From d9ddda897e506db6ba541844be6367014eb90aba Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Tue, 21 Sep 2021 12:03:41 -0500
Subject: [PATCH 08/13] Updates
---
aspnetcore/blazor/components/prerendering-and-integration.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index d52f2249ab9b..d44e781ee06c 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -56,7 +56,7 @@ To set up prerendering for a hosted Blazor WebAssembly app:
+ @using BlazorHosted.Client
```
- * Update the stylesheet links to point to the WebAssembly project's stylesheets. In the following example, the client project's namespace is `BlazorHosted.Client`. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Layout.cshtml` file. Update the `render-mode` of the Component Tag Helper (`` tag) for the `HeadOutlet` component to `WebAssemblyPrerendered`.
+ * Update the stylesheet links to point to the WebAssembly project's stylesheets. In the following example, the client project's namespace is `BlazorHosted.Client`. The `{APP NAMESPACE}` placeholder represents the namespace of the donor app that provided the `_Layout.cshtml` file. Remove the Component Tag Helper (`` tag) for the `HeadOutlet` component.
```diff
-
@@ -64,7 +64,6 @@ To set up prerendering for a hosted Blazor WebAssembly app:
-
+
+
- +
```
> [!NOTE]
From 1f56226315c30b4f4a9853c6d2413b535319230d Mon Sep 17 00:00:00 2001
From: guardrex <1622880+guardrex@users.noreply.github.com>
Date: Wed, 22 Sep 2021 10:05:47 -0500
Subject: [PATCH 09/13] Updates
---
.../prerendering-and-integration.md | 106 +++++++++++++++---
1 file changed, 93 insertions(+), 13 deletions(-)
diff --git a/aspnetcore/blazor/components/prerendering-and-integration.md b/aspnetcore/blazor/components/prerendering-and-integration.md
index d44e781ee06c..b668b6a75f34 100644
--- a/aspnetcore/blazor/components/prerendering-and-integration.md
+++ b/aspnetcore/blazor/components/prerendering-and-integration.md
@@ -103,9 +103,9 @@ To set up prerendering for a hosted Blazor WebAssembly app:
### Configuration for embedding Razor components into pages and views
-The following sections and examples in this article for embedding Razor components of the client Blazor WebAssembly app into pages and views of the server app require additional configuration.
+This section covered how to embed Razor components into pages and views of a hosted Blazor WebAssembly app's **`Server`** project.
-Use a default Razor Pages or MVC layout file in the **`Server`** project. The **`Server`** project must have the following files and folders.
+The **`Server`** project must have the following files and folders.
Razor Pages:
@@ -119,10 +119,29 @@ MVC:
* `Views/_ViewImports.cshtml`
* `Views/_ViewStart.cshtml`
-Obtain the preceding files from an app created from the Razor Pages or MVC project template. For more information, see or .
+The preceding files can be obtained by generating an app from the ASP.NET Core project templates using:
+
+* Visual Studio's new project creation tools.
+* Opening a command shell and executing `dotnet new razor -o {APP NAME}` (Razor Pages) or `dotnet new mvc -o {APP NAME}` (MVC). The option `-o|--output` with a value for the `{APP NAME}` placeholder provides a name for the app and creates a folder for the app.
Update the namespaces in the imported `_ViewImports.cshtml` file to match those in use by the **`Server`** project receiving the files.
+`Pages/_ViewImports.cshtml` (Razor Pages):
+
+```razor
+@using BlazorHosted.Server
+@namespace BlazorHosted.Server.Pages
+@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
+```
+
+`Views/_ViewImports.cshtml` (MVC):
+
+```razor
+@using BlazorHosted.Server
+@using BlazorHosted.Server.Models
+@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
+```
+
Update the imported layout file (`_Layout.cshtml`) to include the **`Client`** project's styles. In the following example, the **`Client`** project's namespace is `BlazorHosted.Client`. The `` element can be updated at the same time.
`Pages/Shared/_Layout.cshtml` (Razor Pages) or `Views/Shared/_Layout.cshtml` (MVC):
@@ -140,6 +159,16 @@ Update the imported layout file (`_Layout.cshtml`) to include the **`Client`** p
```
+Add the Blazor script tag to the layout file inside where the `Scripts` section is rendered near the closing `