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
Copy file name to clipboardExpand all lines: nservicebus/vscode.md
+16-18Lines changed: 16 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Debugging NServiceBus in Visual Studio Code
3
3
summary: How to configure Visual Studio Code to build and debug multiple NServiceBus endpoints simultaneously
4
4
component: Core
5
-
reviewed: 2023-03-12
5
+
reviewed: 2025-05-09
6
6
---
7
7
8
8
This article describes how to configure [Visual Studio Code](https://code.visualstudio.com/) (or "VS Code") to build an NServiceBus solution with multiple projects and debug multiple endpoints simultaneously.
@@ -14,7 +14,7 @@ While Visual Studio contains specific support for .NET projects, VS Code is a mo
14
14
## Prerequisities
15
15
16
16
* This article assumes knowledge of NServiceBus solutions.
17
-
* VS Code must have the [C# for Visual Studio Code (powered by OmniSharp)](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp) extension installed.
17
+
* VS Code must have the [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp) installed.
18
18
19
19
## Configuration files
20
20
@@ -35,10 +35,9 @@ Both of these files can be generated from within VS Code, but the default values
35
35
36
36
To create the initial file:
37
37
38
-
1. Attempt to start debugging.
39
-
2. Click **Configure Task** in the error dialog that appears.
40
-
3. Select **Create tasks.json from template**.
41
-
4. Select **.NET Core**.
38
+
1. After opening a folder with the project in Visual Studio Code, you may receive a notification saying `Required assets to build and debug are missing. Add them?`. If you decide to add them, then Visual Studio Code will create predefined configurations like `.NET Core Launch`.
39
+
1. Alternatively, you can click the button `Generate C# Assets for Build and Debug` in the `Run and Debug` pane.
40
+
1. Alternatively, you can run the command **Tasks: Configure Task**, then **Create tasks.json from template**, and then select **.NET Core**.
42
41
43
42
The file created by VS Code may work as-is if the project contains only one solution file in the project's root directory.
44
43
@@ -70,16 +69,15 @@ For more information on **tasks.json**, see [Visual Studio Code: Integrate with
70
69
71
70
To create the initial file:
72
71
73
-
1. In the Debug toolbar, click the **No Configurations** dropdown.
74
-
1. Select **Add Configuration**.
75
-
1. Select **.NET Core**.
72
+
1. Run the command **Debug: Add Configuration**.
73
+
1. Select **.NET 5+ and .NET Core**.
76
74
77
75
The high-level structure of the **launch.json** file contains a collection of individual project objects in `configurations` and an optional [`compounds` collection](#launch-json-compounds) that lists multiple configurations that should be launched at the same time.
78
76
79
77
```json
80
78
{
81
79
"version": "0.2.0",
82
-
"configurations: [
80
+
"configurations": [
83
81
84
82
],
85
83
"compounds": [
@@ -98,7 +96,7 @@ Here is an example configuration for an NServiceBus endpoint hosted as a console
@@ -115,7 +113,7 @@ Most of the values can be considered boilerplate, except for the `program` and `
115
113
*`program`: Identifies the DLL to use as the entry point.
116
114
*`args`: Specifies any command-line arguments that are needed.
117
115
*`cwd`: Specifies the current working directory for the launched `dotnet` process.
118
-
*`stopAtEntry`: If set to true, the debugger will break at the entry point even when a breakpoint has not been set.
116
+
*`stopAtEntry`: If set to `true`, the debugger will break at the entry point even when a breakpoint has not been set.
119
117
*`console`: Set to `externalTerminal` to use external console windows rather than VS Code's built-in terminal. This is useful when running multiple NServiceBus endpoints.
120
118
121
119
### Web application
@@ -206,7 +204,7 @@ This example shows an entire **launch.json** file with **Sales** and **Billing**
0 commit comments