在Visual Studio宏中,如何在输出窗格(即通常包含生成输出的窗口)上写入执行信息?
如果相关的话,我正在使用VisualStudio2008。
解决方案
:我在我的宏项目中添加了以下子项,我将它们发布在这里,以防它们有用。
Private Sub Write(ByVal name As String, ByVal message As String)
Dim output As Window = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
Dim window As OutputWindow = output.Object
Dim pane As OutputWindowPane = window.OutputWindowPanes.Item(name)
pane.Activate()
pane.OutputString(message)
pane.OutputString(Environment.NewLine)
End Sub
Private Sub Log(ByVal message As String, ByVal ParamArray args() As Object)
Write("Debug", String.Format(message, args))
End Sub
Private Sub Log(ByVal message As String)
Write("Debug", message)
End Sub