.net - Visual Studio 2008 宏 : write to output pane

标签 .net visual-studio-2008 macros

在 Visual Studio 宏中,如何在输出 Pane (即通常包含构建输出的窗口)上写入执行信息?

如果相关,我正在使用 Visual Studio 2008。

解决方案 :我将以下子程序添加到我的宏项目中,我将它们张贴在这里以防它们有用。

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

最佳答案

快速搜索发现 this关于代码项目的文章。它应该能够帮助你。

关于.net - Visual Studio 2008 宏 : write to output pane,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1496959/

相关文章:

javascript - 在asp.net的每个页面上注入(inject)javascript

.net - 通用列表匹配任何值

c++ - Visual Studio 中的 Qml

macros - set-macro-character 的非终止-p 参数有什么作用?

c - 如何在函数体中使用外部宏?

c - 在 C 中使用粘贴运算符 `##` 和类型

.net MAUI 无法看到 iOS 方法和属性,因为它的状态为禁用

c++ - Visual C++ (2008) 调试快照

windows - RC2247 : Cannot open Rc file : Resource explorer cannot load resource ; Load failed

c# - 由于 "User-defined conversions to or from a derived class are not allowed,"在我的情况下有一个不错的选择吗?