From 2c1e6a81efe19d14a8fc704003070ef4a39faf63 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 22 Oct 2021 13:00:49 -0500 Subject: [PATCH 01/11] Blazor 6.0 migration guidance --- aspnetcore/migration/50-to-60.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index 822e350687a9..5a7984777d1a 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -4,7 +4,7 @@ author: rick-anderson description: Learn how to migrate an ASP.NET Core 5.0 project to ASP.NET Core 6.0. ms.author: riande monikerRange: '>= aspnetcore-6.0' -ms.date: 10/15/2021 +ms.date: 10/22/2021 no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR] uid: migration/50-to-60 --- @@ -158,6 +158,22 @@ The existing .NET ecosystem built extensibility around . +* Move the 5.0 app's components and code to the 6.0 app with any required modifications to adopt new 6.0 features. + + +

Frequently asked questions (FAQ)

### Is the new minimal hosting model less capable From 87e1e067630c103e43e97f85363b276e98029b4a Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 22 Oct 2021 13:08:35 -0500 Subject: [PATCH 02/11] Updates --- aspnetcore/migration/50-to-60.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index 5a7984777d1a..1294e4673894 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -174,6 +174,8 @@ To adopt all of the new 6.0 features for Blazor apps, we recommend the following For more information on new Blazor features for 6.0, see [Announcing ASP.NET Core in .NET 6](https://devblogs.microsoft.com/aspnet/announcing-asp-net-core-in-net-6/). --> +Learn about breaking and non-breaking changes for ASP.NET Core apps, including for Blazor apps, at the [Announcements GitHub repository](https://github.com/aspnet/Announcements/issues?q=is%3Aissue+label%3A6.0.0+is%3Aopen). +

Frequently asked questions (FAQ)

### Is the new minimal hosting model less capable From e82755bcdc028e98ec53515986b08c0e167eda95 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 22 Oct 2021 13:10:18 -0500 Subject: [PATCH 03/11] Updates --- aspnetcore/migration/50-to-60.md | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index 1294e4673894..d398f611e2a6 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -158,24 +158,6 @@ The existing .NET ecosystem built extensibility around . -* Move the 5.0 app's components and code to the 6.0 app with any required modifications to adopt new 6.0 features. - - - -Learn about breaking and non-breaking changes for ASP.NET Core apps, including for Blazor apps, at the [Announcements GitHub repository](https://github.com/aspnet/Announcements/issues?q=is%3Aissue+label%3A6.0.0+is%3Aopen). -

Frequently asked questions (FAQ)

### Is the new minimal hosting model less capable @@ -214,6 +196,24 @@ Custom DI containers are supported. See [Custom dependency injection (DI) contai `WebApplicationFactory` is the way to test the new hosting model. See [Test with WebApplicationFactory or TestServer](xref:migration/50-to-60-samples#twa) for an example. +## Blazor + +Update Blazor apps that target the ASP.NET Core 5.0 shared framework and runtime following the guidance earlier in this article: + +* Update the app's [Target Framework Moniker (TFM)](/dotnet/standard/frameworks) to `net6.0`. +* Update the app's package reference versions to 6.0.0. + +To adopt all of the new 6.0 features for Blazor apps, we recommend the following process: + +* Create a new Blazor project from one of the Blazor project templates. For more information, see . +* Move the 5.0 app's components and code to the 6.0 app with any required modifications to adopt new 6.0 features. + + + +Learn about breaking and non-breaking changes for ASP.NET Core apps, including for Blazor apps, at the [Announcements GitHub repository](https://github.com/aspnet/Announcements/issues?q=is%3Aissue+label%3A6.0.0+is%3Aopen). + ## Update Docker images For apps using Docker, update your *Dockerfile* `FROM` statements and scripts. Use a base image that includes the ASP.NET Core 6.0 runtime. Consider the following `docker pull` command difference between ASP.NET Core 5.0 and 6.0: From 5733d3ecb9194cb91b6fe681621b6b84e8bbde86 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 22 Oct 2021 13:26:14 -0500 Subject: [PATCH 04/11] Updates --- aspnetcore/migration/50-to-60.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index d398f611e2a6..3f42f44fd817 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -60,7 +60,7 @@ Update the project file's [Target Framework Moniker (TFM)](/dotnet/standard/fram ## Update package references -In the project file, update each [Microsoft.AspNetCore.*](https://www.nuget.org/packages?q=Microsoft.AspNetCore.*) and [Microsoft.Extensions.*](https://www.nuget.org/packages?q=Microsoft.Extensions.*) package reference's `Version` attribute to 6.0.0 or later. For example: +In the project file, update each [`Microsoft.AspNetCore.*`](https://www.nuget.org/packages?q=Microsoft.AspNetCore.*) and [`Microsoft.Extensions.*`](https://www.nuget.org/packages?q=Microsoft.Extensions.*) package reference's `Version` attribute to 6.0.0 or later. For example: ```diff @@ -198,10 +198,11 @@ Custom DI containers are supported. See [Custom dependency injection (DI) contai ## Blazor -Update Blazor apps that target the ASP.NET Core 5.0 shared framework and runtime following the guidance earlier in this article: +Update 5.0 Blazor apps following the guidance earlier in this article: -* Update the app's [Target Framework Moniker (TFM)](/dotnet/standard/frameworks) to `net6.0`. -* Update the app's package reference versions to 6.0.0. +* Update the app's [Target Framework Moniker (TFM)](/dotnet/standard/frameworks) to `net6.0`. For more information, see the [Update the target framework](#update-the-target-framework) section. +* Update the app's `Microsoft.AspNetCore.*` and `Microsoft.Extensions.*` package references to 6.0.0. For more information, see the [Update package references](#update-package-references) section. +* Update additional packages to their latest versions that target ASP.NET Core 6.0. To adopt all of the new 6.0 features for Blazor apps, we recommend the following process: From 6f855c7d430588614c3f29149b14fdcc02a0747f Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 22 Oct 2021 13:28:31 -0500 Subject: [PATCH 05/11] Updates --- aspnetcore/migration/50-to-60.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index 3f42f44fd817..ed987487b1f2 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -207,7 +207,7 @@ Update 5.0 Blazor apps following the guidance earlier in this article: To adopt all of the new 6.0 features for Blazor apps, we recommend the following process: * Create a new Blazor project from one of the Blazor project templates. For more information, see . -* Move the 5.0 app's components and code to the 6.0 app with any required modifications to adopt new 6.0 features. +* Move the 5.0 app's components and code to the 6.0 app making modifications to adopt the new 6.0 features. -Learn about breaking and non-breaking changes for ASP.NET Core apps, including for Blazor apps, at the [Announcements GitHub repository](https://github.com/aspnet/Announcements/issues?q=is%3Aissue+label%3A6.0.0+is%3Aopen). - ## Update Docker images For apps using Docker, update your *Dockerfile* `FROM` statements and scripts. Use a base image that includes the ASP.NET Core 6.0 runtime. Consider the following `docker pull` command difference between ASP.NET Core 5.0 and 6.0: @@ -269,4 +267,4 @@ public DbSet Keys { get; set; } ## Review breaking changes -For breaking changes from .NET 5.0 to .NET 6.0, see [Breaking changes for migration from version 5.0 to 6.0](/dotnet/core/compatibility/6.0). ASP.NET Core and Entity Framework Core are also included in the list. +For breaking changes from .NET 5.0 to .NET 6.0, see [Breaking changes for migration from version 5.0 to 6.0](/dotnet/core/compatibility/6.0). ASP.NET Core and Entity Framework Core are also included in the list. Also see the [Announcements GitHub repository](https://github.com/aspnet/Announcements/issues?q=is%3Aissue+label%3A6.0.0+is%3Aopen). From 99228845286b601832b121a4951d496d7c0c4d4c Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Fri, 22 Oct 2021 13:39:25 -0500 Subject: [PATCH 07/11] Updates --- aspnetcore/migration/50-to-60.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index 119d2922d616..f46c7252dce9 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -267,4 +267,4 @@ public DbSet Keys { get; set; } ## Review breaking changes -For breaking changes from .NET 5.0 to .NET 6.0, see [Breaking changes for migration from version 5.0 to 6.0](/dotnet/core/compatibility/6.0). ASP.NET Core and Entity Framework Core are also included in the list. Also see the [Announcements GitHub repository](https://github.com/aspnet/Announcements/issues?q=is%3Aissue+label%3A6.0.0+is%3Aopen). +For breaking changes from .NET 5.0 to .NET 6.0, see [Breaking changes for migration from version 5.0 to 6.0](/dotnet/core/compatibility/6.0). ASP.NET Core and Entity Framework Core are also included in the list. Additional information is available at the [Announcements GitHub repository (aspnet/Announcements, `6.0.0` label)](https://github.com/aspnet/Announcements/issues?q=is%3Aissue+label%3A6.0.0+is%3Aopen). From 5e2aa655131d7b7e225375f55ec940066be06b20 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 25 Oct 2021 02:33:55 -0500 Subject: [PATCH 08/11] Updates --- aspnetcore/migration/50-to-60.md | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/aspnetcore/migration/50-to-60.md b/aspnetcore/migration/50-to-60.md index 23e8faf57bf6..24818eeca871 100644 --- a/aspnetcore/migration/50-to-60.md +++ b/aspnetcore/migration/50-to-60.md @@ -4,7 +4,7 @@ author: rick-anderson description: Learn how to migrate an ASP.NET Core 5.0 project to ASP.NET Core 6.0. ms.author: riande monikerRange: '>= aspnetcore-5.0' -ms.date: 10/22/2021 +ms.date: 10/25/2021 no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR] uid: migration/50-to-60 --- @@ -84,7 +84,7 @@ The minimal hosting model: * Significantly reduces the number of files and lines of code required to create an app. Only one file is needed with four lines of code. * Unifies `Startup.cs` and `Program.cs` into a single `Program.cs` file. * Uses [top-level statements](/dotnet/csharp/fundamentals/program-structure/top-level-statements) to minimize the code required for an app. -* Uses [global using directives](/dotnet/csharp/whats-new/csharp-10#global-using-directives) to eliminate or minimize the number of [`using statement`](/dotnet/csharp/language-reference/keywords/using-statement) lines required. +* Uses [global `using` directives](/dotnet/csharp/whats-new/csharp-10#global-using-directives) to eliminate or minimize the number of [`using` statement](/dotnet/csharp/language-reference/keywords/using-statement) lines required. The following code displays the `Startup.cs` and `Program.cs` files from an ASP.NET Core 5 Web App template (Razor Pages) with unused `using` statements removed: @@ -129,8 +129,8 @@ See [Frequently asked questions](#faq) in this document for more details on the * The app name defaults to the entry point assembly's name: `Assembly.GetEntryAssembly().GetName().FullName`. When using the in a library, explicitly change the app name to the library's assembly to allow MVC's [application part discovery](xref:mvc/extensibility/app-parts) to work. See [Change the content root, app name, and environment](xref:migration/50-to-60-samples#ccr) in this document for detailed instructions. * The endpoint routing middleware wraps the entire middleware pipeline, therefore there's no need to have explicit calls to `UseEndpoints` to register routes. `UseRouting` can still be used to specify where route matching happens but `UseRouting` doesn't need to be explicitly called. * The [pipeline](xref:fundamentals/middleware/index) is created before any runs, therefore exceptions caused while building the pipeline aren't visible to the `IStartupFilter` call chain. -* Some tools, such as EF migrations, use [Program.CreateHostBuilder](xref:fundamentals/host/generic-host) to access the app's `IServiceProvider` to execute custom logic in the context of the app. These tools have been updated to use a new technique to execute custom logic in the context of the app. [Entity Framework Migrations](/ef/core/managing-schemas/migrations/) is an example of a tool that uses `Program.CreateHostBuilder`in this way. We're working to make sure tools are updated to use the new model. -* It's ***not*** possible to [change any host settings such as app name, environment, or the content root](xref:migration/50-to-60-samples#ccr) after the creation of the . See [Customize IHostBuilder or IWebHostBuilder](xref:migration/50-to-60-samples#cii) for detailed instructions on changing host settings. The following highlighted APIs throw an exception: +* Some tools, such as EF migrations, use [`Program.CreateHostBuilder`](xref:fundamentals/host/generic-host) to access the app's `IServiceProvider` to execute custom logic in the context of the app. These tools have been updated to use a new technique to execute custom logic in the context of the app. [Entity Framework Migrations](/ef/core/managing-schemas/migrations/) is an example of a tool that uses `Program.CreateHostBuilder`in this way. We're working to make sure tools are updated to use the new model. +* It's ***not*** possible to [change any host settings such as app name, environment, or the content root](xref:migration/50-to-60-samples#ccr) after the creation of the . See [Customize `IHostBuilder` or `IWebHostBuilder`](xref:migration/50-to-60-samples#cii) for detailed instructions on changing host settings. The following highlighted APIs throw an exception: