要立即陷入困境,这是一个非常基本的例子:
using System;
using System.Windows.Forms;
class test
{
static void Main()
{
Console.WriteLine("test");
MessageBox.Show("test");
}
}
Run Code Online (Sandbox Code Playgroud)
如果我使用默认选项(在命令行使用csc)编译它,正如预期的那样,它将编译到控制台应用程序.另外,因为我导入了System.Windows.Forms
,它还会显示一个消息框.
现在,如果我使用该选项/target:winexe
,我认为Windows Application
与在项目选项中选择相同,正如预期的那样,我只会看到消息框而没有控制台输出.
(事实上,从命令行启动它的那一刻,我可以在应用程序完成之前发出下一个命令).
所以,我的问题是 - 我知道你可以从控制台应用程序获得"windows"/表单输出,但是无论如何从Windows应用程序显示控制台?
我们可以在VS Code中添加多个不同的终端吗?我计划添加以下三个终端并与所有这些一起工作
- Windows命令提示符
- 电源外壳
- Git Bash
我知道我需要添加以下命令 Preferences => Setting
// // 64-bit cmd if available, otherwise 32-bit
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe",
// // 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
// // Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
Run Code Online (Sandbox Code Playgroud)
我想在上面添加以上三个命令 setting.json
当我点击
+
不同的终端应该打开,我想在不改变首选项的情况下使用这些终端.是否可以在VS Code中使用?