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/debugging-dll-projects.md
+10-14Lines changed: 10 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Debug dynamic-link library (DLL) files and projects
3
3
description: Debug dynamic-link library (DLL) files in Visual Studio, and use Visual Studio to create, build, configure, and debug DLLs.
4
-
ms.date: "04/18/2022"
4
+
ms.date: "04/15/2025"
5
5
ms.topic: "conceptual"
6
6
dev_langs:
7
7
- "CSharp"
@@ -26,25 +26,23 @@ A DLL (dynamic-link library) is a library that contains code and data that can b
26
26
27
27
The following Visual Studio project templates can create DLLs:
28
28
29
-
-C#, Visual Basic, or F# Class Library
30
-
-C# or Visual Basic Windows Forms Control (WCF) Library
31
-
-C++ Dynamic-Link Library (DLL)
29
+
-Class Library (.NET, .NET Framework, and other app platforms)
30
+
- Windows Forms Control Library (.NET and .NET Framework)
31
+
- Dynamic-Link Library (DLL) (C++)
32
32
33
-
For more information, see [MFC debugging techniques](../debugger/mfc-debugging-techniques.md).
34
-
35
-
Debugging a WCF Library is similar to debugging a Class Library. For details, see [Windows Forms Controls](/dotnet/framework/winforms/controls/index).
33
+
Debugging a Windows Forms Control Library is similar to debugging a Class Library. For more information, see [Windows Forms Controls](/dotnet/framework/winforms/controls/index).
36
34
37
35
You usually call a DLL from another project. When you debug the calling project, depending on the DLL configuration, you can step into and debug the DLL code.
When you use a Visual Studio project template to create an app, Visual Studio automatically creates required settings for Debug and Release build configurations. You can change these settings if necessary. For more information, see the following articles:
42
40
41
+
-[How to: Set Debug and Release configurations](../debugger/how-to-set-debug-and-release-configurations.md)
43
42
-[Project settings for a C++ debug configuration](../debugger/project-settings-for-a-cpp-debug-configuration.md)
44
43
-[Project settings for .NET C# debug configurations](../debugger/project-settings-for-csharp-debug-configurations-dotnetcore.md)
45
44
-[Project settings for C# debug configurations](../debugger/project-settings-for-csharp-debug-configurations.md)
46
45
-[Project settings for a Visual Basic debug configuration](../debugger/project-settings-for-a-visual-basic-debug-configuration.md)
47
-
-[How to: Set Debug and Release configurations](../debugger/how-to-set-debug-and-release-configurations.md)
48
46
49
47
### Set C++ DebuggableAttribute
50
48
@@ -82,20 +80,18 @@ For more information on C++ project settings, see [Windows C++ property page ref
82
80
83
81
## <aname="vxtskdebuggingdllprojectsbuildingadebugversion"></a> Build a Debug version
84
82
85
-
Make sure to build a Debug version of the DLL before you start debugging. To debug a DLL, a calling app must be able to find its [.pdb file](../debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger.md) and any other files the DLL requires.
83
+
Make sure to build a Debug version of the DLL before you start debugging. To debug a DLL, a calling app must be able to find its [.pdb file](../debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger.md) and any other files the DLL requires. For more information, see [How to: Set Debug and Release configurations](../debugger/how-to-set-debug-and-release-configurations.md).
86
84
87
85
You can create a custom build task to copy the DLL files to your *\<calling project folder>\Debug* output folder, or you can copy the files there manually.
88
86
89
87
Make sure to call the DLL in its correct location. This may seem obvious, but if a calling app finds and loads a different copy of the DLL, the debugger will never hit the breakpoints you set.
90
88
91
89
## <aname="vxtskdebuggingdllprojectswaystodebugthedll"></a> Debug a DLL
92
90
93
-
You can't run a DLL directly. It must be called by an app, usually an *.exe* file. For more information, see [Visual Studio projects - C++](/cpp/ide/creating-and-managing-visual-cpp-projects).
91
+
You can't run a DLL directly. It must be called by an app, usually an *.exe* file.
94
92
95
93
To debug a DLL, you can [start debugging from the calling app](#vxtskdebuggingdllprojectsthecallingapplication), or [debug from the DLL project](how-to-debug-from-a-dll-project.md) by specifying its calling app. You can also use the debugger [Immediate window](#vxtskdebuggingdllprojectstheimmediatewindow) to evaluate DLL functions or methods at design time, without using a calling app.
96
94
97
-
For more information, see [First look at the debugger](../debugger/debugger-feature-tour.md).
98
-
99
95
### <aname="vxtskdebuggingdllprojectsthecallingapplication"></a> Start debugging from the calling app
100
96
101
97
The app that calls a DLL can be:
@@ -105,6 +101,8 @@ The app that calls a DLL can be:
105
101
- Located on the web and accessed through a URL.
106
102
- A web app with a web page that embeds the DLL.
107
103
104
+
Before you start debugging the calling app, set a breakpoint in the DLL. See [Get started with breakpoints](../debugger/get-started-with-breakpoints.md). When the DLL breakpoint is hit, you can step through the code, observing the action at each line. For more information, see [Navigate code in the debugger](../debugger/navigating-through-code-with-the-debugger.md).
105
+
108
106
To debug a DLL from a calling app, you can:
109
107
110
108
- Open the project for the calling app, and start debugging by selecting **Debug** > **Start Debugging** or pressing **F5**.
@@ -113,8 +111,6 @@ To debug a DLL from a calling app, you can:
113
111
114
112
- Attach to an app that is already deployed and running on a test or production computer. Use this method for DLLs on websites or in web apps. For more information, see [How to: Attach to a running process](../debugger/attach-to-running-processes-with-the-visual-studio-debugger.md).
115
113
116
-
Before you start debugging the calling app, set a breakpoint in the DLL. See [Using breakpoints](../debugger/using-breakpoints.md). When the DLL breakpoint is hit, you can step through the code, observing the action at each line. For more information, see [Navigate code in the debugger](../debugger/navigating-through-code-with-the-debugger.md).
117
-
118
114
During debugging, you can use the **Modules** window to verify the DLLs and *.exe* files the app loads. To open the **Modules** window, while debugging, select **Debug** > **Windows** > **Modules**. For more information, see [How to: Use the Modules window](../debugger/how-to-use-the-modules-window.md).
119
115
120
116
### <aname="vxtskdebuggingdllprojectstheimmediatewindow"></a> Use the Immediate window
0 commit comments