Skip to content

Commit 30bae96

Browse files
authored
Merge pull request #7854 from MicrosoftDocs/main637844511097029890
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 576713a + 5fd7c14 commit 30bae96

31 files changed

+1168
-14
lines changed

docs/debugger/just-my-code.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Debug user code with Just My Code | Microsoft Docs
33
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.
44
ms.custom: SEO-VS-2020
5-
ms.date: 02/13/2019
5+
ms.date: 04/01/2022
66
ms.topic: how-to
77
ms.assetid: 0f0df097-bbaf-46ad-9ad1-ef5f40435079
88
author: mikejo5000
@@ -24,7 +24,17 @@ For most programming languages, Just My Code is enabled by default.
2424

2525
- 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**.
2626

27-
![Enable Just My Code in the Options dialog box](../debugger/media/dbg_justmycode_options.png "Enable Just My Code")
27+
::: moniker range="<=vs-2019"
28+
29+
![Screenshot of Enable Just My Code in the Options dialog box.](../debugger/media/vs-2019/dbg-just-my-code-options.png "Enable Just My Code")
30+
31+
::: moniker-end
32+
33+
::: moniker range=">=vs-2022"
34+
35+
![Screenshot of Enable Just My Code in the Options dialog box.](../debugger/media/vs-2022/dbg-just-my-code-options.png "Enable Just My Code")
36+
37+
::: moniker-end
2838

2939
> [!NOTE]
3040
> **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.
3343

3444
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).
3545

36-
![User code in the Modules window](../debugger/media/dbg_justmycode_module.png "User code in the Modules window")
46+
::: moniker range="<=vs-2019"
47+
48+
![Screenshot of user code in the Modules window.](../debugger/media/vs-2019/dbg-just-my-code-module.png "User code in the Modules window")
49+
50+
::: moniker-end
51+
52+
::: moniker range=">=vs-2022"
53+
54+
![Screenshot of user code in the Modules window.](../debugger/media/vs-2022/dbg-just-my-code-module.png "User code in the Modules window")
55+
56+
::: moniker-end
3757

3858
In the **Call Stack** or **Tasks** window, Just My Code collapses non-user code into a grayed-out annotated code frame labeled `[External Code]`.
3959

40-
![External Code frame in the Call Stack window](../debugger/media/dbg_justmycode_externalcode.png "External Code frame")
60+
::: moniker range="<=vs-2019"
61+
62+
![Screenshot of External Code in the Call Stack window.](../debugger/media/vs-2019/dbg-just-my-code-external-code.png "External Code frame")
63+
64+
::: moniker-end
65+
66+
::: moniker range=">=vs-2022"
67+
68+
![Screenshot of External Code in the Call Stack window.](../debugger/media/vs-2022/dbg-just-my-code-external-code.png "External Code frame")
69+
70+
::: moniker-end
4171

4272
>[!TIP]
4373
>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.
4474
4575
<a name="BKMK_Override_call_stack_filtering"></a>
4676
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.
4777

48-
![Show External Code in the Call Stack window](../debugger/media/dbg_justmycode_showexternalcode.png "Show External Code")
78+
::: moniker range="<=vs-2019"
79+
80+
![Screenshot of Show External Code in the Call Stack window.](../debugger/media/vs-2019/dbg-just-my-code-show-external-code.png "Show External Code")
81+
82+
::: moniker-end
83+
84+
::: moniker range=">=vs-2022"
85+
86+
![Screenshot of Show External Code in the Call Stack window.](../debugger/media/vs-2022/dbg-just-my-code-show-external-code.png "Show External Code")
87+
88+
::: moniker-end
4989

5090
> [!NOTE]
5191
> **Show External Code** is a current user profiler setting that applies to all projects in all languages that are opened by the user.
27.3 KB
Loading
269 Bytes
Loading
-26.7 KB
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/debugger/navigating-through-code-with-the-debugger.md

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ In *break mode*, app execution is suspended while functions, variables, and obje
3434

3535
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:
3636

37-
![Animation that shows selecting Run To Cursor and then F11.](../debugger/media/navigate-code-code-stepping.gif)
37+
::: moniker range="<=vs-2019"
38+
39+
![Animation that shows selecting Run To Cursor and then F11.](../debugger/media/vs-2019/navigate-code-code-stepping.gif)
40+
41+
::: moniker-end
42+
43+
::: moniker range=">=vs-2022"
44+
45+
![Animation that shows selecting Run To Cursor and then F11.](../debugger/media/vs-2022/navigate-code-code-stepping.gif)
46+
47+
::: moniker-end
3848

3949
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.
4050

@@ -89,7 +99,17 @@ You might prefer to run directly to a specific location or function when you kno
8999

90100
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.
91101

92-
![Screenshot that shows how to set a breakpoint.](../debugger/media/dbg_basics_setbreakpoint.png)
102+
::: moniker range="<=vs-2019"
103+
104+
![Screenshot that shows how to set a breakpoint.](../debugger/media/vs-2019/dbg-basics-set-breakpoint.png)
105+
106+
::: moniker-end
107+
108+
::: moniker range=">=vs-2022"
109+
110+
![Screenshot that shows how to set a breakpoint.](../debugger/media/vs-2022/dbg-basics-set-breakpoint.png)
111+
112+
::: moniker-end
93113

94114
Breakpoints in Visual Studio provide a rich set of functionality, like conditional breakpoints and tracepoints. For details, see [Using breakpoints](../debugger/using-breakpoints.md).
95115

@@ -103,13 +123,34 @@ You can set the debugger to run until it reaches a specified function. You can s
103123

104124
1. In the **New Function Breakpoint** dialog, enter the name of the function and select its language:
105125

106-
![Screenshot that shows the New Function Breakpoint dialog.](../debugger/media/dbg_execution_newbreakpoint.png)
126+
::: moniker range="<=vs-2019"
127+
128+
![Screenshot that shows the New Function Breakpoint dialog.](../debugger/media/vs-2019/dbg-execution-new-breakpoint.png)
129+
130+
::: moniker-end
131+
132+
::: moniker range=">=vs-2022"
133+
134+
![Screenshot that shows the New Function Breakpoint dialog.](../debugger/media/vs-2022/dbg-execution-new-breakpoint.png)
135+
136+
::: moniker-end
137+
107138

108139
1. Select **OK**.
109140

110141
If the function is overloaded or in more than one namespace, you can choose the one you want in the **Breakpoints** window:
111142

112-
![Screenshot that shows overloaded function breakpoints.](../debugger/media/dbg_execution_overloadedbreakpoints.png)
143+
::: moniker range="<=vs-2019"
144+
145+
![Screenshot that shows breakpoints window.](../debugger/media/vs-2019/dbg-execution-overloaded-breakpoints.png)
146+
147+
::: moniker-end
148+
149+
::: moniker range=">=vs-2022"
150+
151+
![Screenshot that shows breakpoints window.](../debugger/media/vs-2022/dbg-execution-overloaded-breakpoints.png)
152+
153+
::: moniker-end
113154

114155
**To select a function breakpoint from the call stack**
115156

@@ -142,7 +183,7 @@ While the debugger is paused, you can hover over a statement in source code or t
142183

143184
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.
144185

145-
![Screenshot that shows Force Run to Click.](../debugger/media/dbg_force-run-to-cursor.png)
186+
![Screenshot that shows Force Run to Click.](../debugger/media/dbg-force-run-to-cursor.png)
146187

147188
> [!NOTE]
148189
> **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**
156197

157198
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.
158199

159-
![Animation that shows how to move the pointer.](../debugger/media/dbg_basics_example3.gif)
200+
::: moniker range="<=vs-2019"
201+
202+
![Animation that shows how to move the pointer.](../debugger/media/vs-2019/dbg-basics-example3.gif)
203+
204+
::: moniker-end
205+
206+
::: moniker range=">=vs-2022"
207+
208+
![Animation that shows how to move the pointer.](../debugger/media/vs-2022/dbg-basics-example3.gif)
209+
210+
::: moniker-end
211+
160212

161213
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**.
162214

docs/ide/how-to-specify-build-events-csharp.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,52 @@ When a project is built, pre-build events are added to a file named *PreBuildEve
7474

7575
:::moniker-end
7676

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.
7878

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:
89+
90+
![Screenshot showing pre-build event example.](./media/vs-2022/pre-build-event-example.png)
91+
92+
That pre-build event results in the following entry, called a `Target` in your project file:
93+
94+
```xml
95+
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
96+
<Exec Command="echo Configuration: $(Configuration)&#xD;&#xA;echo DevEnvDir: $(DevEnvDir)&#xD;&#xA;echo OutDir: $(OutDir)&#xD;&#xA;echo ProjectDir: $(ProjectDir)&#xD;&#xA;echo VisualStudioVersion: $(VisualStudioVersion)&#xD;&#xA;echo AssemblySearchPaths: $(AssemblySearchPaths)&#xD;&#xA;echo AssemblyName: $(AssemblyName)&#xD;&#xA;echo BaseIntermediateOutputPath: $(BaseIntermediateOutputPath)&#xD;&#xA;echo CscToolPath: $(CscToolPath)" />
97+
</Target>
98+
```
99+
100+
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
110+
1>Configuration: Debug
111+
1>DevEnvDir: C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\
112+
1>OutDir: bin\Debug\net6.0\
113+
1>ProjectDir: C:\source\repos\ConsoleApp4\ConsoleApp4\
114+
1>VisualStudioVersion: 17.0
115+
1>ALToolsPath:
116+
1>AssemblySearchPaths: {CandidateAssemblyFiles};{HintPathFromItem};{TargetFrameworkDirectory};{RawFileName}
117+
1>AssemblyName: ConsoleApp4
118+
1>BaseIntermediateOutputPath: obj\
119+
1>CscToolsPath:
120+
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
121+
1>ConsoleApp4 -> C:\Users\ghogen\source\repos\ConsoleApp4\ConsoleApp4\bin\Debug\net6.0\ConsoleApp4.dll
122+
```
81123

82124
## Example
83125

Loading

docs/msbuild/msbuild.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ For more information, see [Multitargeting](../msbuild/msbuild-multitargeting-ove
192192
| [Advanced concepts](../msbuild/msbuild-advanced-concepts.md) | Presents batching, performing transforms, multitargeting, and other advanced techniques. |
193193
| [Logging in MSBuild](../msbuild/logging-in-msbuild.md) | Describes how to log build events, messages, and errors. |
194194
| [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. |
195197
| [Additional resources](https://social.msdn.microsoft.com/forums/vstudio/home?forum=msbuild) | Lists community and support resources for more information about MSBuild. |
196198

197199
## Reference

docs/msbuild/task-writing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,6 @@ The following example shows a project file invoking the previous example task, S
261261

262262
## See also
263263

264+
- [Create a custom task](tutorial-custom-task-code-generation.md)
265+
- [Create a REST API client with MSBuild](tutorial-rest-api-client-msbuild.md)
264266
- [Task reference](../msbuild/msbuild-task-reference.md)

docs/msbuild/toc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ items:
7373
href: how-to-ignore-errors-in-tasks.md
7474
- name: Build a project that has resources
7575
href: how-to-build-a-project-that-has-resources.md
76+
- name: Create a custom task for code generation
77+
href: tutorial-custom-task-code-generation.md
78+
- name: Create a REST API client in a build
79+
href: tutorial-rest-api-client-msbuild.md
80+
- name: Test a custom task
81+
href: tutorial-test-custom-task.md
7682
- name: Inline tasks
7783
items:
7884
- name: MSBuild inline tasks

0 commit comments

Comments
 (0)