我只是打开一个控制台应用程序,然后输入
Console.WriteLine("Test");
但是输出窗口没有显示这一点。我用Ctrl + W, O切换到输出窗口。
但是当我运行程序时什么都没有显示。是我疯了还是这在Visual Studio 2010 Express中不支持?
我只是打开一个控制台应用程序,然后输入
Console.WriteLine("Test");
但是输出窗口没有显示这一点。我用Ctrl + W, O切换到输出窗口。
但是当我运行程序时什么都没有显示。是我疯了还是这在Visual Studio 2010 Express中不支持?
当前回答
如果你正在开发一个命令行应用程序,你也可以在你的代码末尾使用console . readline()来等待'Enter'键,然后关闭控制台窗口,这样你就可以读取输出。
其他回答
Console.Writeline()显示在调试输出中(debug => Windows => output)。
这里没有一个答案对我有用!!这里的大多数人都被困在Windows桌面应用程序控制台。如果你是一个使用ASP的web开发人员。NET在Visual Studio中看不到任何控制台或调试文本,下面是如何修复这个问题:
Paste the following two tests into your code so it runs both lines. These are tests for the output window: System.Console.WriteLine($"hello console!"); System.Diagnostics.Debug.WriteLine($"hello debugger!"); In Visual Studio choose VIEW > OUTPUT. You will see the results above in this output window after changing two settings below. When NOT DEBUGGING, in the OUTPUT window at the top under "Show Output From" choose: "YourProjectName - ASP.NET CORE Web Server". Run your code. You should see the "Console" text above. When DEBUGGING, in the OUTPUT window at the top under "Show Output From" choose: "Debugger". Run your code in debug mode. You should see the "Debug" text above.
将执行模式改为“Self - Hosted”。在这种情况下,将出现执行控制台,并显示所有消息。
也许控制台正在清理。试一试:
Console.WriteLine("Test");
Console.ReadLine();
在你按回车键之前,它会一直在那里。
在“解决方案资源管理器”窗口中转到您自己项目中的属性,选择应用程序类型并查找“输出类型”。
将其值更改为控制台应用程序。
这将使控制台屏幕除了你的形式。如果您关闭控制台屏幕,您的表单也将被关闭。