visual-studio 输出窗口到文件 (Visual Studio 2005)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/420154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 10:02:27  来源:igfitidea点击:

Output window to file (Visual Studio 2005)

visual-studiovisual-studio-2005windowcustomization

提问by

In Visual Studio 2005, how can I save what's written to the output window to a file (I can't change the code writing to the output window, and it writes a lot; I just want to save the output window content to a file)?

在 Visual Studio 2005 中,如何将写入输出窗口的内容保存到文件中(我无法更改写入输出窗口的代码,它写了很多;我只想将输出窗口内容保存到文件中) )?

回答by jeebus

"File" -> "SaveOutputAs..." let's you save the contents of the output window to a file, but I imagine you want to redirect the output to a file while debugging? I'm still looking for a way to do that myself..

“文件”->“SaveOutputAs...”让您将输出窗口的内容保存到文件中,但我想您想在调试时将输出重定向到文件?我仍在寻找自己的方法来做到这一点..

回答by Shabbir Hussain

You can just redirect the output stream in the command line arguments in Visual Studio.

您可以在 Visual Studio 的命令行参数中重定向输出流。

Right click on your project → PropertiesConfiguration propertiesDebuggingCommand arguments.

右键单击您的项目 →属性配置属性调试命令参数

After your arguments, just add:

在您的论点之后,只需添加:

> outputfile.txt

回答by Martin Beckett

If you mean the output to the debug/trace window, you can capture this at runtime with DebugViewwithout running Visual Studio.

如果您指的是调试/跟踪窗口的输出,您可以在运行时使用DebugView捕获它,而无需运行 Visual Studio。

回答by Carl

I just answered a very similar question here. I'm using this method myself to capture, filter and log debug output to a file on Windows Vista 32 bit. I use Visual Studio 2005 and work in C++, so this might help you too.

我刚刚在这里回答了一个非常相似的问题。我自己使用这种方法来捕获、过滤调试输出并将其记录到 Windows Vista 32 位上的文件中。我使用 Visual Studio 2005 并在 C++ 中工作,因此这也可能对您有所帮助。

回答by xtofl

ATLTrace Toolintercepts the ATLTRACE calls. You can save the output of any process into a file.

ATLTrace 工具拦截 ATLTRACE 调用。您可以将任何进程的输出保存到文件中。

回答by Dirk Vollmar

Are you developing in .NET? And what is the code used to write to the output window?

您是在 .NET 中开发吗?用于写入输出窗口的代码是什么?

In case you are using Trace.WriteLine or Debug.WriteLine you could use a TextWriterFileListener class to write all messages to a file automatically.

如果您使用 Trace.WriteLine 或 Debug.WriteLine,您可以使用 TextWriterFileListener 类自动将所有消息写入文件。

回答by StingyHyman

If the app runs in a command window, you can use the old DOS redirect command ">" to redirect the output to a file.

如果应用程序在命令窗口中运行,您可以使用旧的 DOS 重定向命令“>”将输出重定向到文件。

For example.

例如。

c:\>dir > out.txt

...will redirect the output of the dir command to a file called out.txt. You should be able to do the same with your application.

...将 dir 命令的输出重定向到名为 out.txt 的文件。您应该能够对您的应用程序执行相同的操作。

This willstop the output from going to the console, but you can always go the log file to get you the info you want.

阻止输出到控制台,但您始终可以访问日志文件以获取所需的信息。