Visual Studio: configure debug to attach to process

I'm using Visual Studio 2008; is it possible to configure a project debugging options to automatically attach to a process with a certain name when hitting F5?

Edit: actual macro, specifying to attach to managed code:

Sub AttachToMyProcess()
    Try
        Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
        Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
        Dim dbgeng(1) As EnvDTE80.Engine
        dbgeng(0) = trans.Engines.Item("Managed")
        Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, "MyMachine").Item("MyProcess")
        proc2.Attach2(dbgeng)
    Catch ex As System.Exception
        MsgBox(ex.Message)
    End Try
End Sub 

It is possible. You can write a macro like this

    DTE.Debugger.DetachAll()
    For Each proc As EnvDTE.Process In DTE.Debugger.LocalProcesses
        If proc.Name.IndexOf("processname") <> -1 Then
            proc.Attach()
        End If
    Next

And then change VS key bindings to execute this macro when F5 is pressed


尝试按CTRL + ALT + P。假设你可以重映射Debug.AttachtoProcess。


我已经为此编写了插件,您可能想尝试一下。

链接地址: http://www.djcxy.com/p/95400.html

上一篇: jQuery提示和技巧

下一篇: Visual Studio:配置调试以附加到进程