Skip to content

Commit dfcb53d

Browse files
authored
Freshness Edit: Visual Studio | 411511 (#13836)
* article refresh * edits * edits * article + images refresh * Update headings for managed DLL projects
1 parent a161e76 commit dfcb53d

5 files changed

+103
-71
lines changed

docs/debugger/how-to-debug-from-a-dll-project.md

+38-31
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Debug a DLL Project from the project itself
3-
description: You can start the debugging of a DLL project from the project itself, by specifying the calling app in the project properties. See this article for details.
4-
ms.date: 4/21/2023
2+
title: Debug a DLL Project from the Project Itself
3+
description: Learn how to start debugging a DLL project from the project itself by specifying the calling application in the project properties.
4+
ms.date: 04/18/2025
55
ms.topic: how-to
66
dev_langs:
77
- CSharp
@@ -17,96 +17,103 @@ author: mikejo5000
1717
ms.author: mikejo
1818
manager: mijacobs
1919
ms.subservice: debug-diagnostics
20+
#customer intent: As a developer, I want to debug a DLL project from the project itself in Visual Studio, so I can trigger debug actions from the calling application.
2021
---
2122
# Debug from a DLL project in Visual Studio (C#, C++, Visual Basic, F#)
2223

23-
One way to debug a DLL project is to specify the calling app in the DLL project properties. Then you can start debugging from the DLL project itself. For this method to work, the app must call the same DLL in the same location as the one you configure. If the app finds and loads a different version of the DLL, that version won't contain your breakpoints. For other methods of debugging DLLs, see [Debugging DLL projects](../debugger/debugging-dll-projects.md).
24+
One way to debug a DLL project is to specify the calling app in the DLL project properties. This approach lets you start debugging from the DLL project itself. For this method to work, the app must call the same DLL in the same location as the one you configure. If the app finds and loads a different version of the DLL, that version doesn't contain your breakpoints. For other methods of debugging DLLs, see [Debugging DLL projects](../debugger/debugging-dll-projects.md).
2425

2526
If your managed app calls a native DLL, or your native app calls a managed DLL, you can debug both the DLL and the calling app. For more information, see [How to: Debug in mixed mode](../debugger/how-to-debug-in-mixed-mode.md).
2627

2728
Native and managed DLL projects have different settings to specify calling apps.
2829

2930
## Specify a calling app in a native DLL project
3031

31-
1. Select the C++ DLL project in **Solution Explorer**. Select the **Properties** icon, press **Alt**+**Enter**, or right-click and choose **Properties**.
32+
1. In **Solution Explorer**, right-click the C++ DLL project and select **Properties** (**Alt**+**Enter**).
3233

33-
1. In the **\<Project> Property Pages** dialog box, make sure the **Configuration** field at the top of the window is set to **Debug**.
34+
1. In the **\<Project> Property Pages** dialog, set the **Configuration** field at the top to **Debug**.
3435

3536
1. Select **Configuration Properties** > **Debugging**.
3637

37-
1. In the **Debugger to launch** list, choose either **Local Windows Debugger** or **Remote Windows Debugger**.
38+
1. Expand the **Debugger to launch** list and select **Local Windows Debugger** or **Remote Windows Debugger**.
3839

3940
1. In the **Command** or **Remote Command** box, add the fully qualified path and filename of the calling app, such as an *.exe* file.
4041

41-
![Debug Properties window](../debugger/media/dbg-debugging-properties-dll.png "Debug Properties window")
42+
:::image type="content" source="../debugger/media/dbg-debugging-properties-dll.png" alt-text="Screenshot of the Debug Properties window in Visual Studio showing the value for the command." lightbox="../debugger/media/dbg-debugging-properties-dll.png":::
4243

4344
1. Add any necessary program arguments to the **Command Arguments** box.
4445

4546
1. Select **OK**.
4647

4748
::: moniker range=">= vs-2022"
48-
## Specify a calling app in a C# DLL project (.NET Core, .NET 5+)
4949

50-
1. Select the C# or Visual Basic DLL project in **Solution Explorer**. Select the **Properties** icon, press **Alt**+**Enter**, or right-click and choose **Properties**.
50+
## Specify a calling app in a managed DLL project (.NET Core, .NET 5+)
51+
52+
1. In **Solution Explorer**, right-click the C# or Visual Basic DLL project and select **Properties** (**Alt**+**Enter**).
5153

5254
1. In the Debug tab, select **Open Debug launch profiles UI**.
5355

54-
1. In the Launch Profiles dialog box, select the **Create a new profile** icon, and choose **Executable**.
56+
1. In the **Launch Profiles** dialog, select the **Create a new profile** icon, and select **Executable**.
5557

56-
:::image type="content" source="../debugger/media/vs-2022/dbg-profile-create-new.png" alt-text="Screenshot of the UI to create a new debug profile.":::
58+
:::image type="content" source="../debugger/media/vs-2022/dbg-profile-create-new.png" border="false" alt-text="Screenshot of the UI to create a new debug profile in Visual Studio 2022." lightbox="../debugger/media/vs-2022/dbg-profile-create-new.png":::
5759

5860
1. In the new profile, under **Executable**, browse to the location of the executable (*.exe* file) and select it.
5961

60-
1. In the Launch Profiles dialog box, note the name of the default profile, then select it and delete it.
62+
1. In the **Launch Profiles** dialog, note the name of the default profile, then select the profile and delete it.
6163

6264
1. Rename the new profile to the same name as the default profile.
6365

64-
Alternatively, you can manually edit *launchSettings.json* to get the same result. You want the first profile in *launchSettings.json* to match the name of the Class Library, and you want it listed first in the file.
66+
An alternate approach is to manually edit the *launchSettings.json* file. You want the first profile in the *launchSettings.json* file to match the name of the Class Library, and you want the profile listed first in the file.
6567

6668
::: moniker-end
6769

68-
## Specify a calling app in a managed DLL project
70+
## Specify a calling app in a managed DLL project (.NET Framework)
6971

70-
1. Select the C# or Visual Basic DLL project in **Solution Explorer**. Select the **Properties** icon, press **Alt**+**Enter**, or right-click and choose **Properties**.
72+
1. In **Solution Explorer**, right-click the C# or Visual Basic DLL project and select **Properties** (**Alt**+**Enter**).
7173

72-
1. Make sure that the **Configuration** field at the top of the window is set to **Debug**.
74+
1. Set the **Configuration** field at the top to **Debug**.
7375

7476
1. Under **Start action**:
7577

7678
- For .NET Framework DLLs, select **Start external program**, and add the fully qualified path and name of the calling app.
7779

78-
- Or, select **Start browser with URL** and fill in the URL of a local ASP.NET app.
80+
- Or, select **Start browser with URL** and enter the URL of a local ASP.NET app.
7981

8082
::: moniker range=">= vs-2022"
81-
- For .NET Core DLLs in Visual Basic, the **Debug** Properties page is different. Select **Executable** from the **Launch** dropdown, and then add the fully qualified path and name of the calling app in the **Executable** field.
83+
84+
- For .NET Core DLLs in Visual Basic, the **Debug** Properties page is different. Expand the **Launch** dropdown and select **Executable**, and then add the fully qualified path and name of the calling app in the **Executable** field.
85+
8286
::: moniker-end
8387
::: moniker range="<= vs-2019"
84-
- For .NET Core DLLs, the **Debug** Properties page is different. Select **Executable** from the **Launch** dropdown, and then add the fully qualified path and name of the calling app in the **Executable** field.
88+
89+
- For .NET Core DLLs, the **Debug** Properties page is different. Expand the **Launch** dropdown and select **Executable**, and then add the fully qualified path and name of the calling app in the **Executable** field.
90+
8591
::: moniker-end
8692

8793
1. Add any necessary command-line arguments in the **Command line arguments** or **Application arguments** field.
8894

89-
![C# Debug Properties window](../debugger/media/dbg-debugging-properties-dll-csharp.png "C# Debug Properties window")
95+
:::image type="content" source="../debugger/media/dbg-debugging-properties-dll-csharp.png" border="false" alt-text="Screenshot of the C# Debug Properties window in Visual Studio." lightbox="../debugger/media/dbg-debugging-properties-dll-csharp.png":::
9096

91-
1. Use **File** > **Save Selected Items** or **Ctrl**+**S** to save changes.
97+
1. To save your changes, select **File** > **Save Selected Items** (**Ctrl**+**S**).
9298

9399
## Debug from the DLL project
94100

95101
1. Set breakpoints in the DLL project.
96102

97-
1. Right-click the DLL project and choose **Set as Startup Project**.
103+
1. Right-click the DLL project and select **Set as Startup Project**.
98104

99-
1. Make sure the **Solutions Configuration** field is set to **Debug**. Press **F5**, click the green **Start** arrow, or select **Debug** > **Start Debugging**.
105+
1. Set the **Solutions Configuration** field at the top to **Debug**. Select **F5** and then select the green **Start** arrow, or select **Debug** > **Start Debugging**.
100106

101-
Additional tips:
102-
103-
- If debugging does not hit your breakpoints, make sure that your DLL output (by default, the *\<project>\Debug* folder) is the location that the calling app is calling.
104-
105-
- If you want to break into code in a managed calling app from a native DLL, or vice versa, enable [mixed mode debugging](../debugger/how-to-debug-in-mixed-mode.md).
106-
107-
- In some scenarios, you may need to tell the debugger where to find the source code. For more information, see [Use the No Symbols Loaded/No Source Loaded pages](../debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger.md#use-the-no-symbols-loadedno-source-loaded-pages).
107+
> [!TIP]
108+
>
109+
> - If debugging doesn't hit your breakpoints, make sure your DLL output (by default, the *\<project>\Debug* folder) is the target call location for the calling app.
110+
>
111+
> - If you want to break into code in a managed calling app from a native DLL, or vice versa, enable [mixed mode debugging](../debugger/how-to-debug-in-mixed-mode.md).
112+
>
113+
> - In some scenarios, you might need to instruct the debugger where to find the source code. For more information, see [Use the No Symbols Loaded/No Source Loaded pages](../debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger.md#use-the-no-symbols-loadedno-source-loaded-pages).
108114
109115
## Related content
116+
110117
- [Debugging DLL projects](../debugger/debugging-dll-projects.md)
111118
- [Project settings for C# debug configurations](../debugger/project-settings-for-csharp-debug-configurations.md)
112119
- [Project settings for a Visual Basic debug configuration](../debugger/project-settings-for-a-visual-basic-debug-configuration.md)
Loading
Loading
Loading

0 commit comments

Comments
 (0)