You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update SignalR tutorials for .NET 10 and Visual Studio 2026 (#36695)
* Initial plan
* Update SignalR tutorials for .NET 10 and Visual Studio 2026
Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
* Update Get started with ASP.NET Core SignalR
* rename includes files
* update Get started with ASP.NET Core SignalR using TypeScript
* fix warning
* update code samples
* fix link to sample code in repo
* Update aspnetcore/tutorials/signalr.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
Co-authored-by: Meaghan Osagie <mosagie@microsoft.com>
Co-authored-by: Meaghan Osagie (Lewis) <moneikmarie@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: aspnetcore/tutorials/signalr-typescript-webpack.md
+35-30Lines changed: 35 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,20 @@
1
1
---
2
2
title: "Tutorial: Get started with ASP.NET Core SignalR using TypeScript and Webpack"
3
+
ai-usage: ai-assisted
3
4
author: ssougnez
4
5
description: This tutorial provides a walkthrough of bundling and building an ASP.NET Core SignalR web app using TypeScript and Webpack.
5
-
monikerRange: ">= aspnetcore-2.1"
6
6
<!-- ms.author: bradyg -->
7
+
monikerRange: ">= aspnetcore-2.1"
7
8
ms.author: wpickett
8
9
ms.custom: mvc, engagement-fy23
9
-
ms.date: 11/07/2023
10
+
ms.date: 01/27/2026
10
11
uid: tutorials/signalr-typescript-webpack
11
12
---
12
13
# Tutorial: Get started with ASP.NET Core SignalR using TypeScript and Webpack
13
14
14
15
[!INCLUDE[](~/includes/not-latest-version.md)]
15
16
16
-
By [Sébastien Sougnez](https://twitter.com/s_sougnez)
17
-
18
-
:::moniker range=">= aspnetcore-8.0"
17
+
:::moniker range=">= aspnetcore-10.0"
19
18
20
19
This tutorial demonstrates using [Webpack](https://webpack.js.org/) in an ASP.NET Core SignalR web app to bundle and build a client written in [TypeScript](https://www.typescriptlang.org/). Webpack enables developers to bundle and build the client-side resources of a web app.
21
20
@@ -28,19 +27,19 @@ In this tutorial, you learn how to:
28
27
> * Configure the SignalR TypeScript client
29
28
> * Enable communication between the client and the server
30
29
31
-
[View or download sample code](https://github.com/dotnet/AspNetCore.Docs.Samples/tree/main/tutorials/signalr-typescript-webpack/samples) ([how to download](xref:fundamentals/index#how-to-download-a-sample))
30
+
[View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/signalr-typescript-webpack/samples) ([how to download](xref:fundamentals/index#how-to-download-a-sample))
32
31
33
32
## Prerequisites
34
33
35
34
*[Node.js](https://nodejs.org/) with [npm](https://www.npmjs.com/)
36
35
37
36
# [Visual Studio](#tab/visual-studio)
38
37
39
-
[!INCLUDE[](~/includes/net-prereqs-vs-8.0.md)]
38
+
[!INCLUDE[](~/includes/net-prereqs-vs-10.md)]
40
39
41
40
# [Visual Studio Code](#tab/visual-studio-code)
42
41
43
-
[!INCLUDE[](~/includes/net-prereqs-vsc-8.0.md)]
42
+
[!INCLUDE[](~/includes/net-prereqs-vsc-10.0.md)]
44
43
45
44
---
46
45
@@ -50,28 +49,32 @@ In this tutorial, you learn how to:
50
49
51
50
By default, Visual Studio uses the version of npm found in its installation directory. To configure Visual Studio to look for npm in the `PATH` environment variable:
52
51
53
-
Launch Visual Studio. At the start window, select **Continue without code**.
52
+
Launch the latest version of Visual Studio. At the start window, select **Continue without code**.
54
53
55
54
1. Navigate to **Tools** > **Options** > **Projects and Solutions** > **Web Package Management** > **External Web Tools**.
56
55
1. Select the `$(PATH)` entry from the list. Select the up arrow to move the entry to the second position in the list, and select **OK**:
57
56
58
-
.
57
+
:::image type="content" source="~/tutorials/signalr-typescript-webpack/media/configure-path.png" alt-text="Visual Studio Configuration.":::
59
58
60
59
To create a new ASP.NET Core web app:
61
60
62
-
1. Use the **File** > **New** > **Project** menu option and choose the **ASP.NET Core Empty** template. Select **Next**.
63
-
1. Name the project `SignalRWebpack`, and select **Create**.
64
-
1. Select **.NET 8.0 (Long Term Support)** from the **Framework** drop-down. Select **Create**.
61
+
1. Use the **File** > **New** > **Project/Solution...** menu option.
62
+
1. In the **Create a new project** dialog, select **ASP.NET Core Empty** template. Then select **Next**.
63
+
1. In the **Configure your new project** dialog, enter `SignalRWebpack` for **Project name**. Select **Next**.
64
+
1. In the **Additional information** dialog, select **.NET 10.0 (Long Term Support)** from the **Framework** drop-down. Select **Create**.
65
65
66
66
Add the [Microsoft.TypeScript.MSBuild](https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild/) NuGet package to the project:
67
67
68
-
1. In **Solution Explorer**, right-click the project node and select **Manage NuGet Packages**. In the **Browse** tab, search for `Microsoft.TypeScript.MSBuild` and then select **Install** on the right to install the package.
68
+
1. In **Solution Explorer**, right-click the project node and select **Manage NuGet Packages...**.
69
+
1. In the **Browse** tab, search for `Microsoft.TypeScript.MSBuild` and then select **Install** on the right to install the package.
70
+
1. In the **Preview Changes** dialog, select **Apply**.
71
+
1. In the **License Acceptance** dialog, select **I Accept**.
69
72
70
73
Visual Studio adds the NuGet package under the **Dependencies** node in **Solution Explorer**, enabling TypeScript compilation in the project.
71
74
72
75
# [Visual Studio Code](#tab/visual-studio-code)
73
76
74
-
Run the following commands in the **Integrated Terminal**:
1. Again, in `Program.cs`, call <xref:Microsoft.AspNetCore.Builder.DefaultFilesExtensions.UseDefaultFiles%2A> and <xref:Microsoft.AspNetCore.Builder.StaticFileExtensions.UseStaticFiles%2A>:
The preceding code allows the server to locate and serve the `index.html` file. The file is served whether the user enters its full URL or the root URL of the web app.
109
112
110
113
1. Create a new directory named `Hubs` in the project root, `SignalRWebpack/`, for the SignalR hub class.
111
114
112
115
1. Create a new file, `Hubs/ChatHub.cs`, with the following code:
The preceding code broadcasts received messages to all connected users once the server receives them. It's unnecessary to have a generic `on` method to receive all the messages. A method named after the message name is enough.
117
120
@@ -124,11 +127,11 @@ In this section, you configure the ASP.NET Core web app to send and receive Sign
124
127
125
128
1. Add the following `using` statement at the top of `Program.cs` to resolve the `ChatHub` reference:
The preceding file configures the Webpack compilation process:
174
177
@@ -177,23 +180,23 @@ In this section, you create a [Node.js](https://nodejs.org/) project to convert
177
180
178
181
1. Create a new directory named `src` in the project root, `SignalRWebpack/`, for the client code.
179
182
180
-
1. Copy the `src` directory and its contents from the [sample project](https://github.com/dotnet/AspNetCore.Docs.Samples/tree/main/tutorials/signalr-typescript-webpack/samples/8.x/SignalRWebpack/) into the project root. The `src` directory contains the following files:
183
+
1. Copy the `src` directory and its contents from the [sample project](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/signalr-typescript-webpack/samples/) into the project root. The `src` directory contains the following files:
181
184
182
185
* `index.html`, which defines the homepage's boilerplate markup:
The preceding code retrieves references to DOM elements and attaches two event handlers:
199
202
@@ -257,7 +260,7 @@ Confirm that the app works with the following steps:
257
260
258
261
---
259
262
260
-

263
+
:::image type="content" source="~/tutorials/signalr-typescript-webpack/media/browser-message-broadcast.png" alt-text="Message displayed in both browser windows.":::
261
264
262
265
## Next steps
263
266
@@ -272,6 +275,8 @@ Confirm that the app works with the following steps:
0 commit comments