diff --git a/aspnetcore/includes/net-prereqs-vs-11-latest.md b/aspnetcore/includes/net-prereqs-vs-11-latest.md new file mode 100644 index 000000000000..2b192ebd3b24 --- /dev/null +++ b/aspnetcore/includes/net-prereqs-vs-11-latest.md @@ -0,0 +1,3 @@ +* [Visual Studio](https://visualstudio.microsoft.com/downloads/) with the **ASP.NET and web development** workload. + + ![VS22 installer workloads](~/tutorials/min-web-api/_static/asp-net-web-dev.png) diff --git a/aspnetcore/includes/net-prereqs-vsc-11.md b/aspnetcore/includes/net-prereqs-vsc-11.md new file mode 100644 index 000000000000..888cf9d941df --- /dev/null +++ b/aspnetcore/includes/net-prereqs-vsc-11.md @@ -0,0 +1,5 @@ +* [Visual Studio Code](https://code.visualstudio.com/download) +* [C# Dev Kit for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) +* [!INCLUDE [](~/includes/0-latest-SDK.md)] + +You can follow the Visual Studio Code instructions on macOS, Linux, or Windows. Changes may be required if you use an integrated development environment (IDE) other than Visual Studio Code. diff --git a/aspnetcore/migration/100-to-110.md b/aspnetcore/migration/100-to-110.md new file mode 100644 index 000000000000..a6bfd2145683 --- /dev/null +++ b/aspnetcore/migration/100-to-110.md @@ -0,0 +1,78 @@ +--- +title: Migrate from ASP.NET Core in .NET 10 to ASP.NET Core in .NET 11 +author: wadepickett +description: Learn how to migrate an ASP.NET Core in .NET 10 to ASP.NET Core in .NET 11. +ms.author: wpickett +ms.date: 01/26/2026 +uid: migration/100-to-110 +--- +# Migrate from ASP.NET Core in .NET 10 to ASP.NET Core in .NET 11 + + + +This article explains how to update an ASP.NET Core in .NET 10 to ASP.NET Core in .NET 10. + +## Prerequisites + +# [Visual Studio](#tab/visual-studio) + +[!INCLUDE[](~/includes/net-prereqs-vs-11-latest.md)] + +# [Visual Studio Code](#tab/visual-studio-code) + +[!INCLUDE[](~/includes/net-prereqs-vsc-11.md)] + +--- + +## Update the .NET SDK version in `global.json` + +If you rely on a [`global.json`](/dotnet/core/tools/global-json) file to target a specific .NET SDK version, update the `version` property to the .NET 11 SDK version that's installed. For example: + +```diff +{ + "sdk": { +- "version": "10.0.102" ++ "version": "11.0.100" + } +} +``` + +## Update the target framework + +Update the project file's [Target Framework Moniker (TFM)](/dotnet/standard/frameworks) to `net11.0`: + +```diff + + + +- net10.0 ++ net11.0 + + + +``` + +## Update package references + +In the project file, update each [`Microsoft.AspNetCore.*`](https://www.nuget.org/packages?q=Microsoft.AspNetCore.*), [`Microsoft.EntityFrameworkCore.*`](https://www.nuget.org/packages?q=Microsoft.EntityFrameworkCore.*), [`Microsoft.Extensions.*`](https://www.nuget.org/packages?q=Microsoft.Extensions.*), and [`System.Net.Http.Json`](https://www.nuget.org/packages/System.Net.Http.Json) package reference's `Version` attribute to 11.0.0 or later. For example: + +```diff + +- +- +- +- ++ ++ ++ ++ + +``` + +## Blazor + +[!INCLUDE[](~/migration/100-to-110/includes/blazor.md)] + +## Breaking changes + +Use the articles in [Breaking changes in .NET](/dotnet/core/compatibility/breaking-changes) to find breaking changes that might apply when upgrading an app to a newer version of .NET. diff --git a/aspnetcore/migration/100-to-110/includes/blazor.md b/aspnetcore/migration/100-to-110/includes/blazor.md new file mode 100644 index 000000000000..2c9deabed7db --- /dev/null +++ b/aspnetcore/migration/100-to-110/includes/blazor.md @@ -0,0 +1,54 @@ +### Blazor release notes + +For new feature coverage, see . + +### Adopt Inline JS event handler removed from the `NavMenu` component + +*This section only applies to Blazor Web Apps.* + +The inline JS event handler for the navigation bar toggler isn't present in the `NavMenu` component of the Blazor Web App project template in .NET 11 or later. Apps generated from the project template use a [collocated JS module](xref:blazor/js-interop/javascript-location#load-a-script-from-an-external-javascript-file-js-collocated-with-a-component) approach to show or hide the navigation links on the rendered page. The approach improves [Content Security Policy (CSP) compliance](xref:blazor/security/content-security-policy) because it doesn't require the CSP to include an unsafe hash for the inline JS. + +Use the following instructions to adopt the new JS module approach for the navigation links toggler in an existing app. + +Add a [collocated JS module](xref:blazor/js-interop/javascript-location#load-a-script-from-an-external-javascript-file-js-collocated-with-a-component) next to the app's `NavMenu` component. + +`NavMenu.razor.js`: + +```javascript +// Handle navigation menu toggle +const navScrollable = document.getElementById("nav-scrollable"); +const navToggler = document.querySelector(".navbar-toggler"); + +if (navScrollable && navToggler) { + navScrollable.addEventListener("click", function() { + navToggler.click(); + }); +} +``` + +At the top of the app's `NavMenu` component (`NavMenu.razor`), add a ` +``` + +* Otherwise, use the following tag, which indicates the path to the module in the `Components/Layout` folder: + +```razor + +``` + +Also in the app's `NavMenu` component, change the line that has the inline JS to toggle the navigation links: + +```diff +-