写入 Visual Studio 的输出窗口 [英] Writing to output window of Visual Studio

查看:30
本文介绍了写入 Visual Studio 的输出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将消息写入输出窗口以进行调试.我搜索了一个类似于 Java 的 system.out.println("") 的函数.我尝试了 Debug.WriteConsole.WriteTrace.Write.它不会给出错误,但也不会打印任何内容.

I am trying to write a message to the output window for debugging purposes. I searched for a function like Java's system.out.println(""). I tried Debug.Write, Console.Write, and Trace.Write. It does not give an error, but it does not print anything either.

选中定义调试常量"和定义跟踪常量"选项.

"Define DEBUG constant" and "Define TRACE constant" options are checked.

菜单 工具选项调试将所有输出窗口文本重定向到立即窗口"选项未检查.

Menu ToolsOptionsDebugging"Redirect all Output Window text to the Immediate Window" option is not checked.

配置:活动(调试)

注意:如果相关,我使用向导创建了一个项目为Windows 窗体应用程序".我不知道去哪里找.

Note: I created a project with the wizard as "Windows Forms Application" if relevant. I have no idea where to look.

推荐答案

添加System.Diagnostics命名空间,然后就可以使用Debug.WriteLine()快速将消息打印到 IDE 的输出窗口.有关更多详细信息,请参阅以下内容:

Add the System.Diagnostics namespace, and then you can use Debug.WriteLine() to quickly print a message to the output window of the IDE. For more details, please refer to these:

这篇关于写入 Visual Studio 的输出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆