求助,如何保存Visual Studio的输出日志到记事本中
“WindowsTest.vshost.exe”(托管): 已加载“C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll”,已跳过符号加载。已对模块进行了优化并启用了调试器选项“仅我的代码”。“WindowsTest.vshost.exe”(托管): 已加载“C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll”,已跳过符号加载。已对模块进行了优化并启用了调试器选项“仅我的代码”。
就是这些输出文件中内容。 --------------------编程问答-------------------- 复制粘贴 --------------------编程问答-------------------- 可以利用visual studio的宏编辑器实现:
打开宏编辑器(菜单: 工具-宏-宏IDE),
点开EnvironmentEvents,选中Build events,选OnBuildDone,然后添加代码:
Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone
Const BUILD_OUTPUT_PANE_GUID As String = "{1BD8A850-02D1-11D1-BEE7-00A0C913D1F8}"
Dim t As OutputWindowPane
Dim txtOutput As TextDocument
Dim txtSelection As TextSelection
Dim vsWindow As Window
vsWindow = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindOutput)
Dim vsOutputWindow As OutputWindow
Dim objOutputWindowPane As OutputWindowPane
Dim objBuildOutputWindowPane As OutputWindowPane
vsOutputWindow = DirectCast(vsWindow.Object, OutputWindow)
For Each objOutputWindowPane In vsOutputWindow.OutputWindowPanes
If objOutputWindowPane.Guid.ToUpper = BUILD_OUTPUT_PANE_GUID Then
objBuildOutputWindowPane = objOutputWindowPane
Exit For
End If
Next
txtOutput = objBuildOutputWindowPane.TextDocument
txtSelection = txtOutput.Selection
txtSelection.StartOfDocument(False)
txtSelection.EndOfDocument(True)
objBuildOutputWindowPane.OutputString(Date.Now)
txtSelection = txtOutput.Selection
solutionDir = IO.Path.GetDirectoryName(DTE.Solution.FullName)
My.Computer.FileSystem.WriteAllText(solutionDir & "\build_output.log", txtSelection.Text, False)
MsgBox(txtSelection.Text)
End Sub
更多的参考stackoverflow:
http://stackoverflow.com/questions/5298428/capture-build-output-within-visual-studio-2010 --------------------编程问答-------------------- ,这个有点看不懂,还有更清楚一点的吗
补充:.NET技术 , C#