简体   繁体   English

在VS2012中使用Debug.Write编写消息?

[英]Writing messages with Debug.Write in VS2012?

I am using the following in my C# code: 我在我的C#代码中使用以下内容:

System.Diagnostics.Debug.Write("xxx");

But when I look in the output window I cannot see anything even though my code does execute this line. 但是当我查看输出窗口时,即使我的代码执行此行,我也看不到任何内容。

Is this the correct way to write messages that I can see in the VS2012? 这是编写我在VS2012中可以看到的消息的正确方法吗?

  • Debug.Write will only function if the DEBUG build flag is set. 只有设置了DEBUG构建标志, Debug.Write才会起作用。

OR 要么

  • Debug.Write calls may not display in the output window if you have the Visual Studio option "Redirect all Output Window text to the Immediate Window" checked under the menu 如果您在菜单下选中了Visual Studio选项“将所有输出窗口文本重定向到立即窗口”,则Debug.Write调用可能不会显示在输出窗口中

Tools > Options > Debugging > General. 工具>选项>调试>常规。

To display "Tools > Options > Debugging" , check the box next to "Tools > Options > Show All Settings". 要显示"Tools > Options > Debugging" ,请选中“工具>选项>显示所有设置”旁边的框。

调试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM