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: docs/debugger/debug-dotnet-core-in-wsl-2.md
+77-20Lines changed: 77 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: "Debug .NET apps in Linux using WSL 2"
3
-
description: Learn to run and debug your .NET apps in WSL 2 without leaving Visual Studio.
4
-
ms.date: "07/16/2021"
2
+
title: "Debug .NET apps in Linux using WSL"
3
+
description: Learn to run and debug your .NET apps in WSL without leaving Visual Studio.
4
+
ms.date: "08/06/2021"
5
5
ms.topic: "conceptual"
6
6
helpviewer_keywords:
7
7
- "debugging, linux"
@@ -15,36 +15,58 @@ ms.workload:
15
15
- "multiple"
16
16
---
17
17
18
-
# Debug .NET Apps in WSL 2 with Visual Studio
18
+
# Debug .NET Apps in WSL with Visual Studio
19
19
20
-
You can easily run and debug your .NET apps in Linux without leaving Visual Studio using WSL 2. If you are a cross-platform developer, you can use this method as a simple way to test more of your target environments.
20
+
You can easily run and debug your .NET apps in Linux without leaving Visual Studio using WSL. If you are a cross-platform developer, you can use this method as a simple way to test more of your target environments.
21
21
22
-
For a Windows .NET user targeting Linux, WSL 2 lives in a sweet spot between production realism and productivity. In Visual Studio, you can already debug in a remote Linux environment using the [remote debugger](../debugger/remote-debugging-dotnet-core-linux-with-ssh.md), or with containers using the [Container Tools](../containers/overview.md). When production realism is your main concern, you should use one of those options. When an easy and fast inner-loop is more important, WSL 2 is a great option.
22
+
For a Windows .NET user targeting Linux, WSL lives in a sweet spot between production realism and productivity. In Visual Studio, you can already debug in a remote Linux environment using the [remote debugger](../debugger/remote-debugging-dotnet-core-linux-with-ssh.md), or with containers using the [Container Tools](../containers/overview.md). When production realism is your main concern, you should use one of those options. When an easy and fast inner-loop is more important, WSL is a great option.
23
23
24
-
You don’t have to choose just one method! You can have a launch profile for Docker and WSL 2 in the same project and pick whichever is appropriate for a particular run. And once your app is deployed, you can always use the remote debugger to attach to it if there's an issue.
24
+
You don’t have to choose just one method! You can have a launch profile for Docker and WSL in the same project and pick whichever is appropriate for a particular run. And once your app is deployed, you can always use the remote debugger to attach to it if there's an issue.
25
+
26
+
>[!NOTE]
27
+
> Starting in Visual Studio 2019 version 16.11 Preview 3, the WSL 2 debug target was renamed to WSL.
25
28
26
29
## Prerequisites
27
30
28
-
- Visual Studio 2019 v16.9 Preview 1 or later versions with the .NET Core Debugging with WSL 2 optional component.
31
+
- Visual Studio 2019 v16.9 Preview 1 or later versions with the .NET Debugging with WSL optional component.
29
32
30
33
The optional component is included by default with the .NET Core cross-platform or the ASP.NET and web development workloads. You must install one or both of these workloads.
31
34
32
-
- Install [WSL 2](/windows/wsl/about).
35
+
- Install [WSL](/windows/wsl/about).
33
36
34
37
- Install the [distribution](https://aka.ms/wslstore) of your choice.
35
38
36
-
## Start debugging with WSL 2
39
+
## Start debugging with WSL
37
40
38
-
1. After you've installed the required components, open an ASP.NET Core web app or .NET Core console app in Visual Studio You’ll see a new Launch Profile named WSL 2:
41
+
1. After you've installed the required components, open an ASP.NET Core web app or .NET Core console app in Visual Studio You’ll see a new Launch Profile named WSL:
39
42
40
-

43
+

41
44
42
45
1. Select this profile to add it to your *launchSettings.json*.
43
46
44
47
Some of the key attributes in the file are shown in the following example.
45
48
49
+
::: moniker range=">=vs-2022"
50
+
51
+
>[!NOTE]
52
+
> Starting in Visual Studio 2022 Preview 3, the command name in the Launch Profile changed from WSL2 to WSL.
@@ -55,10 +77,11 @@ You don’t have to choose just one method! You can have a launch profile for Do
55
77
"distributionName": ""
56
78
}
57
79
```
80
+
::: moniker-end
58
81
59
-
Once you select the new profile, the extension checks that your WSL 2 distribution is configured to run .NET apps, and helps you install any missing dependencies. Once you've installed these dependencies, you are ready to debug in WSL 2.
82
+
Once you select the new profile, the extension checks that your WSL distribution is configured to run .NET apps, and helps you install any missing dependencies. Once you've installed these dependencies, you are ready to debug in WSL.
60
83
61
-
1. Start debugging as normal, and your app will run in your default WSL 2 distribution.
84
+
1. Start debugging as normal, and your app will run in your default WSL distribution.
62
85
63
86
An easy way to verify that you're running in Linux is to check the value of `Environment.OSVersion`.
64
87
@@ -69,8 +92,23 @@ You don’t have to choose just one method! You can have a launch profile for Do
69
92
70
93
By default, the WSL 2 launch profile uses the default distribution as set in *wsl.exe*. If you want your launch profile to target a specific distribution, regardless of that default, you can modify your launch profile. For example, if you're debugging a web app and want to test it on Ubuntu 20.04, your launch profile would look like:
@@ -81,29 +119,48 @@ By default, the WSL 2 launch profile uses the default distribution as set in *ws
81
119
"distributionName": "Ubuntu-20.04"
82
120
}
83
121
```
122
+
::: moniker-end
84
123
85
124
## Target multiple distributions
86
125
87
126
Going one step further, if you are working on an application that needs to run in multiple distributions and you want a quick way to test on each of them, you can have multiple launch profiles. For instance, if you need to test your console app on Debian, Ubuntu 18.04, and Ubuntu 20.04, you could use the following launch profiles:
88
127
128
+
::: moniker range=">=vs-2022"
129
+
```json
130
+
"WSL : Debian": {
131
+
"commandName": "WSL",
132
+
"distributionName": "Debian"
133
+
},
134
+
"WSL : Ubuntu 18.04": {
135
+
"commandName": "WSL",
136
+
"distributionName": "Ubuntu-18.04"
137
+
},
138
+
"WSL : Ubuntu 20.04": {
139
+
"commandName": "WSL",
140
+
"distributionName": "Ubuntu-20.04"
141
+
}
142
+
```
143
+
::: moniker-end
144
+
::: moniker range="vs-2019"
89
145
```json
90
-
"WSL 2 : Debian": {
146
+
"WSL : Debian": {
91
147
"commandName": "WSL2",
92
148
"distributionName": "Debian"
93
149
},
94
-
"WSL 2 : Ubuntu 18.04": {
150
+
"WSL : Ubuntu 18.04": {
95
151
"commandName": "WSL2",
96
152
"distributionName": "Ubuntu-18.04"
97
153
},
98
-
"WSL 2 : Ubuntu 20.04": {
154
+
"WSL : Ubuntu 20.04": {
99
155
"commandName": "WSL2",
100
156
"distributionName": "Ubuntu-20.04"
101
157
}
102
158
```
159
+
::: moniker-end
103
160
104
161
With these launch profiles, you can easily switch back and forth between your target distributions, all without leaving the comfort of Visual Studio.
105
162
106
-

163
+

Copy file name to clipboardExpand all lines: docs/ide/whats-new-visual-studio-2019.md
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ Here's a high-level recap of what's new, all-up:
31
31
***[Collaborate](#collaborate)**: Enjoy natural collaboration through a Git-first workflow, real-time editing and debugging, and code reviews right in Visual Studio.
32
32
***[Debug](#debug)**: Highlight and navigate to specific values, optimize memory use, and take automatic snapshots of your application's execution.
33
33
34
-
For a complete list of everything that's new in this version, see the [release notes](/visualstudio/releases/2019/release-notes/).
34
+
For a complete list of everything that's new in this version, see the [release notes](/visualstudio/releases/2019/release-notes/). And, for more info about what's new in the 16.11 release, see the [Visual Studio 2019 v16.11 is available now](https://devblogs.microsoft.com/visualstudio/visual-studio-16-11/) blog post.
35
35
36
36
## Develop
37
37
@@ -218,17 +218,17 @@ We update Visual Studio often with new features that can make your development e
218
218
219
219
Meanwhile, here's what's currently in the works:
220
220
221
-
-**Improved Git experience in Visual Studio 2019 (Preview)**
221
+
-**Improved Git experience in Visual Studio 2019**
222
222
223
-
Although the Git version control tool is default experience in Visual Studio 2019 [version 16.8](/visualstudio/releases/2019/release-notes-history/) and later, we continue to add features to enhance the experience in the preview release of Visual Studio 2019, [version 16.11](/visualstudio/releases/2019/release-notes-preview/).
223
+
Although the Git version control tool is default experience in Visual Studio 2019 [version 16.8](/visualstudio/releases/2019/release-notes-history/) and later, we continue to add features to enhance the experience in the newest release of Visual Studio 2019, [version 16.11](/visualstudio/releases/2019/release-notes-preview/).
224
224
225
225
For more information, see the [Version control in Visual Studio](/visualstudio/version-control/) page.
226
226
227
227
-**Visual Studio 2022 (Preview) is now available**
228
228
229
229
Our newest version, [Visual Studio 2022 (Preview)](/visualstudio/releases/2022/release-notes-preview/) is faster, more approachable, and more lightweight. And, for the first time ever, Visual Studio is 64-bit.
230
230
231
-
For a download link and more info, see the **[Visual Studio 2022 vision](https://devblogs.microsoft.com/visualstudio/visual-studio-2022/)**blog post.
231
+
For a download link and more info, see the [Visual Studio 2022 vision](https://devblogs.microsoft.com/visualstudio/visual-studio-2022/) blog post, along with the [**Visual Studio 2022 Preview 3 now available**](https://devblogs.microsoft.com/visualstudio/visual-studio-2022-preview-3-now-available/)blog post, too.
232
232
233
233
## Give us feedback
234
234
@@ -240,6 +240,7 @@ Why send feedback to the Visual Studio team? Because we take customer feedback s
240
240
241
241
## See also
242
242
243
+
*[What's new in Visual Studio 2022 (Preview)](whats-new-visual-studio-2022.md)
243
244
*[What's new in the Visual Studio docs](whats-new-visual-studio-docs.md)
244
245
*[Visual Studio 2019 release notes](/visualstudio/releases/2019/release-notes/)
245
246
*[Visual Studio 2019 for Mac release notes](/visualstudio/releasenotes/vs2019-mac-relnotes/)
0 commit comments