I am writing a Console application that pass a string array of arguments to the Main. Using the F5 to debug would throw me an exception because I have not pass the arguments.
The way I debug/test the code where I can pass arguments is to build the solution and then run the .exe on the command prompt, but it's very inconvenient.
Is there a way to pass arguments to debug?
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.
You can optionally have gdb pass any arguments after the executable file to the inferior using --args . This option stops option processing. This will cause gdb to debug gcc , and to set gcc 's command-line arguments (see Arguments) to ` -O2 -c foo. c '.
In Visual Studio 2010, right click the project, choose Properties, click the configuring properties section on the left pane, then click Debugging, then on the right pane there is a box for command arguments. In that enter the command line arguments. You are good to go. Now debug and see the result.
Passing arguments to the program being debugged. The --args option must be immediately followed by the command invoking the program you wish to debug. That command should consist of the program name and then its arguments, just as they would appear if you were starting that program without GDB.
From within Visual Studio? Absolutely - go to the project's property designer, select the Debug page and you can set the command line arguments, as well as the working directory. See MSDN for more information.
In Visual Studio right-click on the project name in Solution Explorer. Select Properties from the list. Go to the Debug tab. You can put your parameters in Command Line Arguments textbox.
This page has documentation on C# debugging. Basically, there is a "command line arguments" option in the project's property pages.
You should be able to enter command line arguments in the Project Settings dialog.
There's some info here: http://msdn.microsoft.com/en-us/library/2kf0yb05.aspx
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