Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make VS2010 prompt me for command line arguments

Much like this question is there a way to make Visual Studio 2010 prompt me for command line arguments every time before launching? For one of my projects this would be nice since the arguments need to change on various runs, and it would be easier to do than to keep editing the properties of the project.

like image 365
Urda Avatar asked Nov 17 '25 06:11

Urda


2 Answers

I don't think there's any way of getting Visual Studio itself to prompt for arguments - but you could create a small and simple app which prompted for the appropriate values in Windows Forms, then just invoked the Main method of the "real" project... or even launched it as a separate process.

This would have the additional benefit of making it easier to use in terms of getting the right arguments, I'd imagine.

like image 96
Jon Skeet Avatar answered Nov 19 '25 20:11

Jon Skeet


You could try something like this in your Main:

if (args.Length == 0)
{
    Console.WriteLine("Please provide an argument.");
    string strArg = Console.ReadLine();
}
like image 42
Aaron Avatar answered Nov 19 '25 19:11

Aaron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!