为媒体中心编写插件时,您的插件托管在ehexthost.exe
该exe从ehshell.exe
启动,您无法直接启动它,而是将特殊参数传递给ehshell.exe
这将在一个单独的过程中启动插件。在调试过程中在Visual Studio中自动附加到子进程
当我们正在调试media browser我发现附加到第二个过程种类笨重的过程,我知道有关Debugger.Attach和我可以使用的一些special registry条目。
这两种方法都不完全适合我的账单。我想要的是按F5,并将我当前的Visual Studio实例自动附加到子进程。这可以做到吗?
如果有一个VS插件允许我实现这个功能,我会很高兴。
编辑
我结束了下面的宏会:
Public Sub CompileRunAndAttachToEhExtHost()
DTE.Solution.SolutionBuild.Build(True)
DTE.Solution.SolutionBuild.Debug()
Dim trd As System.Threading.Thread = New System.Threading.Thread(AddressOf AttachToEhExtHost)
trd.Start()
End Sub
Public Sub AttachToEhExtHost()
Dim i As Integer = 0
Do Until i = 50
i = i + 1
Try
For Each proc As EnvDTE.Process In DTE.Debugger.LocalProcesses
If (proc.Name.IndexOf("ehexthost.exe") <> -1) Then
proc.Attach()
Exit Sub
End If
Next
Catch e As Exception
' dont care - stuff may be busy
End Try
Threading.Thread.Sleep(100)
Loop
End Sub
另外,我概述了如何get this going过程在我的博客。
还有其他方式使用新的Debugger2接口,http://www.codeplex.com/lazy/SourceControl/changeset/view/20095#307770 – 2009-01-28 07:15:27
使用Debugger2接口有什么优势吗? – 2009-01-28 22:34:50
是的,而不是在DTE.Debugger.LocalProcesses上循环,你可以得到的进程proc = debugger2.GetProcesses(trans,“”).Item(processName) – 2009-01-29 11:40:34