Partager via


Process.Attach Method

Definition

Causes the debugger to attach this process.

public:
 void Attach();
public:
 void Attach();
void Attach();
[System.Runtime.InteropServices.DispId(1)]
public void Attach ();
[<System.Runtime.InteropServices.DispId(1)>]
abstract member Attach : unit -> unit
Public Sub Attach ()
Attributes

Examples

The following example demonstrates how to use the Attach method.

public static void Attach(DTE dte)  
{  
    EnvDTE.Processes processes = dte.Debugger.LocalProcesses;  
    foreach(EnvDTE.Process proc in processes)  
        if(proc.Name.IndexOf("Target.exe") != -1)  
            proc.Attach();  
}  
Shared Sub Attach(ByRef dte As EnvDTE.DTE)  
    Dim processes As EnvDTE.Processes = dte.Debugger.LocalProcesses  
    For Each proc As EnvDTE.Process In processes  
        If proc.Name.IndexOf("Target.exe") <> -1 Then  
            proc.Attach()  
        End If  
    Next  
End Sub  

Applies to