我正在嘗試編寫一個宏,用於構建我的應用程序,啓動外部工具並將調試器提供給該外部工具。用於構建的Visual Studio 2008宏不會阻塞線程
除了建築物,一切都在工作。它會構建,但它不會阻塞線程,因此外部工具在完成之前就會被啓動。有沒有辦法可以運行ExecuteCommand並等待線程完成?
代碼如下:
DTE.ExecuteCommand("ClassViewContextMenus.ClassViewProject.Build")
DTE.ExecuteCommand("Tools.ExternalCommand11")
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, "MINIPC").Item("_nStep.exe")
proc2.Attach2(dbgeng)
Catch ex As System.Exception
MsgBox(ex.Message)
End Try