在 Visual Studio Code 中使用命令行提示符运行 C# 程序

Emi*_*man 5 .net c# .net-core visual-studio-code

我正在 Visual Studio Code 中运行一个用 C# 编写的继承项目。为了运行该应用程序,它需要接受命令行输入(-t、-h 等)。如何从 Visual Studio 内部对此进行测试?

目前(我一直在学习 dotnet、C#、VS 等)我有一个 hello world 程序,可以从 vsc 的终端运行。由于我无法确定的原因,可能是我如何安装它,dotnet run无法被识别 - 我必须为其提供一个指向 dotnet.exe 的显式路径:C:\Program Files\dotnet\dotnet.exe run

当程序需要命令行输入时我该如何做到这一点?不出所料,我在黑暗中的射击C:\Program Files\dotnet\dotnet.exe run -t没有成功,但我不确定还能尝试什么。

谢谢!

Nic*_*ico 4

如果您要用来dotnet.exe run启动应用程序,则需要添加--switch 语句来指示dotnet.exe将参数传递给应用程序。例如

微软文档

dotnet.exe run -- -arg1 -arg2 (etc)请注意参数--之后dotnet和程序特定参数之前。

GitHub 问题