From c8b021fd2362a56a88e58eb075cd02bfda3b28cc Mon Sep 17 00:00:00 2001 From: Luke Latham Date: Tue, 17 Nov 2020 07:56:59 -0600 Subject: [PATCH] Show Blazor namespaces (#20637) --- aspnetcore/migration/31-to-50.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/aspnetcore/migration/31-to-50.md b/aspnetcore/migration/31-to-50.md index af901dd476..b152d60247 100644 --- a/aspnetcore/migration/31-to-50.md +++ b/aspnetcore/migration/31-to-50.md @@ -80,6 +80,38 @@ If updating a Blazor WebAssembly project, skip to the [Update Blazor WebAssembly + ``` +1. Include a new namespace in the app's `_Imports.razor` file for [component virtualization](xref:blazor/components/virtualization), . The following `_Imports.razor` files show the default namespaces in apps generated from the Blazor project templates. The placeholder `{ASSEMBLY NAME}` is the app's assembly name. + + Blazor WebAssembly (`_Imports.razor`): + + ```razor + @using System.Net.Http + @using System.Net.Http.Json + @using Microsoft.AspNetCore.Components.Forms + @using Microsoft.AspNetCore.Components.Routing + @using Microsoft.AspNetCore.Components.Web + @using Microsoft.AspNetCore.Components.Web.Virtualization + @using Microsoft.AspNetCore.Components.WebAssembly.Http + @using Microsoft.JSInterop + @using {ASSEMBLY NAME} + @using {ASSEMBLY NAME}.Shared + ``` + + Blazor Server (`_Imports.razor`): + + ```razor + @using System.Net.Http + @using Microsoft.AspNetCore.Authorization + @using Microsoft.AspNetCore.Components.Authorization + @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 {ASSEMBLY NAME} + @using {ASSEMBLY NAME}.Shared + ``` + 1. In the `MainLayout` component (`Shared/MainLayout.razor`), surround the component's HTML markup with a `
` element that has a `class` attribute set to `page`: ```razor