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/just-my-code.md
+45-5Lines changed: 45 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Debug user code with Just My Code | Microsoft Docs
3
3
description: Just My Code is a debugging feature that automatically steps over calls to non-user code. Learn how to enable, disable, and use this feature.
4
4
ms.custom: SEO-VS-2020
5
-
ms.date: 02/13/2019
5
+
ms.date: 04/01/2022
6
6
ms.topic: how-to
7
7
ms.assetid: 0f0df097-bbaf-46ad-9ad1-ef5f40435079
8
8
author: mikejo5000
@@ -24,7 +24,17 @@ For most programming languages, Just My Code is enabled by default.
24
24
25
25
- To enable or disable Just My Code in Visual Studio, under **Tools** > **Options** (or **Debug** > **Options**) > **Debugging** > **General**, select or deselect **Enable Just My Code**.
26
26
27
-

27
+
::: moniker range="<=vs-2019"
28
+
29
+

30
+
31
+
::: moniker-end
32
+
33
+
::: moniker range=">=vs-2022"
34
+
35
+

36
+
37
+
::: moniker-end
28
38
29
39
> [!NOTE]
30
40
> **Enable Just My Code** is a global setting that applies to all Visual Studio projects in all languages.
@@ -33,19 +43,49 @@ For most programming languages, Just My Code is enabled by default.
33
43
34
44
During a debugging session, the **Modules** window shows which code modules the debugger is treating as My Code (user code), along with their symbol loading status. For more information, see [Get more familiar with how the debugger attaches to your app](../debugger/debugger-tips-and-tricks.md#modules_window).
35
45
36
-

46
+
::: moniker range="<=vs-2019"
47
+
48
+

49
+
50
+
::: moniker-end
51
+
52
+
::: moniker range=">=vs-2022"
53
+
54
+

55
+
56
+
::: moniker-end
37
57
38
58
In the **Call Stack** or **Tasks** window, Just My Code collapses non-user code into a grayed-out annotated code frame labeled `[External Code]`.
39
59
40
-

60
+
::: moniker range="<=vs-2019"
61
+
62
+

63
+
64
+
::: moniker-end
65
+
66
+
::: moniker range=">=vs-2022"
67
+
68
+

69
+
70
+
::: moniker-end
41
71
42
72
>[!TIP]
43
73
>To open the **Modules**, **Call Stack**, **Tasks**, or most other debugging windows, you must be in a debugging session. While debugging, under **Debug** > **Windows**, select the windows you want to open.
44
74
45
75
<aname="BKMK_Override_call_stack_filtering"></a>
46
76
To view the code in a collapsed **[External Code]** frame, right-click in the **Call Stack** or **Task** window, and select **Show External Code** from the context menu. The expanded external code lines replace the **[External Code**] frame.
47
77
48
-

78
+
::: moniker range="<=vs-2019"
79
+
80
+

81
+
82
+
::: moniker-end
83
+
84
+
::: moniker range=">=vs-2022"
85
+
86
+

87
+
88
+
::: moniker-end
49
89
50
90
> [!NOTE]
51
91
> **Show External Code** is a current user profiler setting that applies to all projects in all languages that are opened by the user.
Copy file name to clipboardExpand all lines: docs/debugger/navigating-through-code-with-the-debugger.md
+58-6Lines changed: 58 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,17 @@ In *break mode*, app execution is suspended while functions, variables, and obje
34
34
35
35
For example, in the code editor in Visual Studio, you can use the **Run To Cursor** command to start the app, debugger attached, and enter break mode, and then select **F11** to navigate through the code:
36
36
37
-

37
+
::: moniker range="<=vs-2019"
38
+
39
+

40
+
41
+
::: moniker-end
42
+
43
+
::: moniker range=">=vs-2022"
44
+
45
+

46
+
47
+
::: moniker-end
38
48
39
49
When you're in break mode, you can use various commands to navigate through your code. You can examine the values of variables to look for violations or bugs. For some project types, you can also make adjustments to the app when you're in break mode.
40
50
@@ -89,7 +99,17 @@ You might prefer to run directly to a specific location or function when you kno
89
99
90
100
To set a simple breakpoint in your code, select the far-left margin next to the line of code where you want to suspend execution. You can also select the line and then select **F9**, select **Debug** > **Toggle Breakpoint**, or right-click and select **Breakpoint** > **Insert Breakpoint**. The breakpoint appears as a red dot in the left margin next to the line of code. The debugger suspends execution just before the line runs.
91
101
92
-

102
+
::: moniker range="<=vs-2019"
103
+
104
+

105
+
106
+
::: moniker-end
107
+
108
+
::: moniker range=">=vs-2022"
109
+
110
+

111
+
112
+
::: moniker-end
93
113
94
114
Breakpoints in Visual Studio provide a rich set of functionality, like conditional breakpoints and tracepoints. For details, see [Using breakpoints](../debugger/using-breakpoints.md).
95
115
@@ -103,13 +123,34 @@ You can set the debugger to run until it reaches a specified function. You can s
103
123
104
124
1. In the **New Function Breakpoint** dialog, enter the name of the function and select its language:
105
125
106
-

126
+
::: moniker range="<=vs-2019"
127
+
128
+

129
+
130
+
::: moniker-end
131
+
132
+
::: moniker range=">=vs-2022"
133
+
134
+

135
+
136
+
::: moniker-end
137
+
107
138
108
139
1. Select **OK**.
109
140
110
141
If the function is overloaded or in more than one namespace, you can choose the one you want in the **Breakpoints** window:
111
142
112
-

143
+
::: moniker range="<=vs-2019"
144
+
145
+

146
+
147
+
::: moniker-end
148
+
149
+
::: moniker range=">=vs-2022"
150
+
151
+

152
+
153
+
::: moniker-end
113
154
114
155
**To select a function breakpoint from the call stack**
115
156
@@ -142,7 +183,7 @@ While the debugger is paused, you can hover over a statement in source code or t
142
183
143
184
While the debugger is paused, you can hover over a statement in source code while pressing the **Shift** key and then select **Force run execution to here** (the double green arrow). When you choose this option, the application attaches the Visual Studio debugger and pauses at the cursor location. Any breakpoints and first-chance exceptions found during execution are temporarily disabled.
144
185
145
-

186
+

146
187
147
188
> [!NOTE]
148
189
> **Force Run to Click** is available starting in [!include[vs_dev17](../misc/includes/vs_dev17_md.md)].
@@ -156,7 +197,18 @@ To break into the next available line of code in a running app, select **Debug**
156
197
157
198
When the debugger is paused, a yellow arrow in the margin of the source code or **Disassembly** window marks the location of the statement that will run next. You can change the next statement that will run by moving this arrow. You can skip over code or return to a previous line. Moving the pointer is useful for situations like skipping code that contains a known bug.
158
199
159
-

200
+
::: moniker range="<=vs-2019"
201
+
202
+

203
+
204
+
::: moniker-end
205
+
206
+
::: moniker range=">=vs-2022"
207
+
208
+

209
+
210
+
::: moniker-end
211
+
160
212
161
213
If you want to change the next statement that will run, the debugger must be in break mode. In the source code or **Disassembly** window, drag the yellow arrow to a different line, or right-click the line you want to run next and select **Set Next Statement**.
Copy file name to clipboardExpand all lines: docs/ide/how-to-specify-build-events-csharp.md
+45-3Lines changed: 45 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -74,10 +74,52 @@ When a project is built, pre-build events are added to a file named *PreBuildEve
74
74
75
75
:::moniker-end
76
76
77
-
The build event syntax can include any command that is valid at a command prompt or in a *.bat* file. The name of a batch file should be preceded by `call` to ensure that all subsequent commands are executed.
77
+
The build event syntax can include any command that is valid at a command prompt or in a *.bat* file. The name of a batch file should be preceded by `call` to ensure that all subsequent commands are executed.
78
78
79
-
> [!NOTE]
80
-
> If your pre-build or post-build event does not complete successfully, you can terminate the build by having your event action exit with a code other than zero (0), which indicates a successful action.
79
+
> [!NOTE]
80
+
> If your pre-build or post-build event does not complete successfully, you can terminate the build by having your event action exit with a code other than zero (0), which indicates a successful action.
81
+
82
+
## Macros
83
+
84
+
Commonly available "macros" (actually MSBuild properties) are listed at [MSBuild common properties](../msbuild/common-msbuild-project-properties.md). For .NET SDK projects (.NET Core or .NET 5 and later), additional properties are listed at [MSBuild properties for Microsoft.NET.Sdk](/dotnet/core/project-sdk/msbuild-props).
85
+
86
+
In your scripts for build events, you might want to reference the values of some project-level variables such as the name of the project or the location of the output folder. In prior versions of Visual Studio, these were called *macros*. The equivalent to macros in recent versions of Visual Studio are MSBuild properties. MSBuild is the build engine that Visual Studio uses to process your project file when it performs a build. A build event in the IDE results in an MSBuild [target](../msbuild/msbuild-targets.md) in the project file. You can use any MSBuild property that is available in the target in your project file (for example, `$(OutDir)` or `$(Configuration)`) . The MSBuild properties that are available to you in these events depend on the files implicitly or explicitly imported in a project file, such `.props` and `.targets` files, and properties set in your project file, such as in `PropertyGroup` elements. Be careful to use the exact spelling of each property. No error is reported if you misspell a property; instead, an undefined property evaluates to an empty string.
87
+
88
+
For example, suppose you specify a pre-build event as follows:
The build event appears as a target that includes the [Exec task](../msbuild/exec-task.md) with the input you specified as the `Command`. Newlines are encoded in the XML.
101
+
102
+
When you build the project in this example, the pre-build event prints the values of some properties. In this example, `$(CscToolPath)` doesn't produce any output, because it's not defined. It is an optional property that you can define in your project file to give the path to a customized instance of the C# compiler (for example, if you were testing a different version of *csc.exe*, or an experimental compiler).
103
+
104
+
Output from your build events is written to the build output, which can be found in the **Output** window. In the **Show output from** dropdown, choose **Build**.
105
+
106
+
```output
107
+
Build started...
108
+
1>------ Build started: Project: ConsoleApp4, Configuration: Debug Any CPU ------
109
+
1>You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
Copy file name to clipboardExpand all lines: docs/msbuild/msbuild.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -192,6 +192,8 @@ For more information, see [Multitargeting](../msbuild/msbuild-multitargeting-ove
192
192
|[Advanced concepts](../msbuild/msbuild-advanced-concepts.md)| Presents batching, performing transforms, multitargeting, and other advanced techniques. |
193
193
|[Logging in MSBuild](../msbuild/logging-in-msbuild.md)| Describes how to log build events, messages, and errors. |
194
194
|[How MSBuild builds projects](build-process-overview.md)| Describes the internal build process used within MSBuild |
195
+
|[Create a custom task for code generation](tutorial-custom-task-code-generation.md)| Shows how to create a custom task, with a code example. |
196
+
|[Use MSBuild to generate a REST API client](tutorial-rest-api-client-msbuild.md)| Shows how to extend the build to handle REST API client generation, with a code example. |
195
197
|[Additional resources](https://social.msdn.microsoft.com/forums/vstudio/home?forum=msbuild)| Lists community and support resources for more information about MSBuild. |
0 commit comments