Visual Studio Code Cant从C#代码获取输出 [英] Visual Studio Code Cant get output from a C# code
问题描述
我正在尝试在VSC 1.13.1中运行一个简单的Hello World代码.
I'm trying to run a simple Hello World code in VSC 1.13.1.
using System;
public class Hello1
{
public static void Main()
{
Console.WriteLine("Hello, World!");
}
}
它成功完成执行,但不产生任何输出,即-您好,世界!
It successfully completes execution but doesnt produce any output ie - Hello, World!
请帮忙!
使用代码运行器.
推荐答案
VSCode(或C#扩展名)当前似乎有问题. StackOverflow的其他答案表明,几年前这种方法不起作用,然后开始起作用,现在(2018年)它不再起作用.
There currently seems to be a problem with VSCode (or the C# extension). Other StackOverflow answers show that this didn't work a few years ago, then it started working, and now (2018) it doesn't work once again.
我遇到了同样的问题.我发现的解决方法是:如果我在调试器中运行代码(调试">开始调试"),它将显示输出.但是,如果我只是正常运行它,则不会.这是我发现或了解的唯一可行的解决方法.
I'm having the same problem. The workaround I found is this: If I run my code in the debugger (Debug > Start Debugging), it shows the output. But if I just run it normally, it doesn't. That's the only workaround I've found or read about that works for me.
这篇关于Visual Studio Code Cant从C#代码获取输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!