我正在使用Visual Studio 2008,是否可以配置项目调试选项,以便在按下F5键时自动附加到具有特定名称的进程?
编辑:实际的宏,指定附加到托管代码:
编辑:实际的宏,指定附加到托管代码:
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