I have an command line that uses arguments, I have no problem with this, but each time I want to test the application, I need to compile it, run the CMD, call the application with the parameters from the CMD, because I didn't find any solution that let me dynamically pass arguments to the console in Visual Studio Any idea about that? Thanks a lot!!
To set command-line arguments in Visual Studio, right click on the project name, then go to Properties. In the Properties Pane, go to "Debugging", and in this pane is a line for "Command-line arguments." Add the values you would like to use on this line. They will be passed to the program via the argv array.
To pass arguments to your application, you need to pass a -- argument, and then the arguments to your application. As per the . NET Core CLI documentation, -- delimits arguments to dotnet run from arguments for the application being run. All arguments after this one are passed to the application run.
Press F5 to run the program in Debug mode. Another way to start debugging is by choosing Debug > Start Debugging from the menu. Enter a string in the console window when the program prompts for a name, and then press Enter . Program execution stops when it reaches the breakpoint and before the Console.
Answers. To set the command line arguments in Visual Studio open the project property page and select the Debug tab at the right of the page and place the arguments in the text box marked Command line arguments as shown in the image below.
Goto Project->Properties
and click the Debug
Tab.
There is a section for command line arguments:
Right click your project in VS -> Properties -> Debug tab
There is an area where you can specify command line arguments. When you debug your project, VS will start it up with these args.
Go to the project properties - Debug section, and under the Start Options heading there is a section for Command line arguments.
If you are using VS 2022, go to the project properties -> Debug -> General, and then click on "Open debug launch profiles UI".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With