简体   繁体   English

Visual Studio 2015:构建窗口的输出为空

[英]Visual Studio 2015: Output from build Window is empty

I'm a super-beginner coder and trying to follow a training video on C# in Visual Studio 2015. The tutorial has me do a new Visual C# project as a Console Application. 我是一位超级初学者,并尝试在Visual Studio 2015中关注C#的培训视频。本教程让我做一个新的Visual C#项目作为控制台应用程序。 When I run my code using Ctrl+F5, it launches my code in the console as expected, but the Output --> Show output from build window is completely empty. 当我使用Ctrl + F5运行代码时,它会按预期在控制台中启动我的代码,但是Output-> Show build build窗口的输出完全为空。

I've scoured this site and others for a solution. 我已经搜索了本网站和其他网站的解决方案。 These are my current VS2015 settings, I've tried changing these with no success: 这些是我当前的VS2015设置,我尝试更改这些设置均未成功:

  • Show Output window when build starts is CHECKED 检查构建开始时的“显示输出”窗口
  • Redirect all Output Window text to the Immediate Window is UNchecked. 未选中将所有“输出窗口”文本重定向到“立即窗口”。

This is the code, verbatim what is shown in the tutorial: 这是完全按照教程中显示的代码的代码:

using System;

namespace Hello
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, World");
        }
    }
}

When the same code is run in the tutorial, the resulting output appears immediately in the Output window: 当在教程中运行相同的代码时,结果输出将立即显示在“输出”窗口中:

1>------ Build started: Project: Hello, Configuration: Debug Any CPU ------
1>  Hello -> c:\users\[name]\documents\visual studio 2015\Projects\Hello\Hello\bin\Debug\Hello.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I can see my Output window and I expect to receive this, but I get nothing. 我可以看到“输出”窗口,并且希望收到此消息,但是却什么也没得到。 First time using Visual Studio, what am I missing? 第一次使用Visual Studio,我会丢失什么?

Prior to adding Console.Read(); 在添加Console.Read();之前Console.Read(); at the end of my code, running the code would launch the console with the following output: 在我的代码末尾,运行代码将启动控制台,并显示以下输出:

Hello, World Press any key to continue... 您好,世界按任意键继续...

But, the build output window in VS remained blank as originally described. 但是,如最初所述,VS中的构建输出窗口仍为空白。

After adding Console.Read(); 添加Console.Read(); , the output in console no longer contained ,不再包含控制台中的输出

Press any key to continue... 按任意键继续...

However, the build output in VS now displays what is expected as described in Original Post. 但是,VS中的生成输出现在可以显示原始帖子中所述的预期结果。

If I then remove Console.Read(); 如果我再删除Console.Read(); , reverting back to my original code, the console output is back to original, and the VS build output window still gives expected output... ,恢复为原始代码,控制台输出恢复为原始代码,并且VS build输出窗口仍提供预期的输出...

I suspect that, using Visual Studio for the first time, it had never been directed to write to the Output window, which was accomplished here with Console.Read(); 我怀疑第一次使用Visual Studio时,它从未被定向到“输出”窗口,这是通过Console.Read(); and should do this going forward... 并应该继续这样做...

Link to solution I used: 链接到我使用的解决方案:

https://stackoverflow.com/a/5301276/11953574 https://stackoverflow.com/a/5301276/11953574

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

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