Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use the <strong>Attach to process</strong> from the <strong>Debug</strong> menu for debugging your DLL project. You may be required to use mixed mode debugging if debugging does not happen with native code. This can be done by selecting <em>Managed and Native</em> code type from the window that appears when you click on <em>Select</em> button inside the <em>Attach to process</em> window.</p> <p>If the edition of Visual Studio that you are using supports macros, then you can create a new macro with the following code to automate all this:</p> <pre><code>Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports EnvDTE90a Imports EnvDTE100 Imports System.Diagnostics Public Module AttachToProcess Public Sub DebugMyDLL() DTE.ExecuteCommand("Build.BuildSelection") Dim ApplicationExePath As String = "C:\Program Files (x86)\foo\bar.exe" Shell(ApplicationExePath) Try Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default") Dim dbgeng(2) As EnvDTE80.Engine dbgeng(0) = trans.Engines.Item("Managed (v4.0)") dbgeng(1) = trans.Engines.Item("Native") Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, "&lt;QualifierName&gt;").Item("bar.exe") proc2.Attach2(dbgeng) Catch ex As System.Exception MsgBox(ex.Message) End Try End Sub End Module </code></pre> <p>The above macro tries to build your project, launches the external application and then attaches your DLL to that program automatically. You can get the <em>QualifierName</em> for your system from the <em>Attach to process</em> window. Also, the version of managed code("Managed (v4.0)" in this case) depends on the version of .NET framework that you use.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload