Running a C # program with command line prompts in Visual Studio Code

I am running a legacy project written in C # inside Visual Studio Code. To run this application, you need to do command line input (-t, -h, etc.). How can I check this from within Visual Studio?

Currently (I am learning dotnet, C #, VS, etc. as I leave) I have a global hello program that I can run from the vsc terminal. For some reason I was not able to determine exactly, perhaps how I installed it is dotnet run

not recognized - I have to pass it the explicit path to dotnet.exe:C:\Program Files\dotnet\dotnet.exe run

How do I do this when a program requires command line input? My shot in the dark C:\Program Files\dotnet\dotnet.exe run -t

supposedly didn't work, but I'm not sure what else to try.

Thank!

+3


source to share


2 answers


If you are using dotnet.exe run

to run your application, you need to add a switch statement --

to instruct you dotnet.exe

to pass arguments to your application. for example

Microsoft Documentation



dotnet.exe run -- -arg1 -arg2 (etc)

pay attention to --

after the arguments dotnet

and before your specific program arguments.

GitHub problem

+2


source


  • Right click on your project
  • Click "Properties"
  • Click "Debug" in the "Properties" window
  • In the "Launch Options" section:
  • Add "Command Line Argument:" = run -t
  • Add "Working Directory": try bin \ debug directory


0


source







All Articles