调试时如何使用参数启动程序? [英] How do I start a program with arguments when debugging?
本文介绍了调试时如何使用参数启动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 Visual Studio 2008 中调试一个程序.问题是如果它没有得到参数它就会退出.这是来自主要方法:
I want to debug a program in Visual Studio 2008. The problem is that it exits if it doesn't get arguments. This is from the main method:
if (args == null || args.Length != 2 || args[0].ToUpper().Trim() != "RM")
{
Console.WriteLine("RM must be executed by the RSM.");
Console.WriteLine("Press any key to exit program...");
Console.Read();
Environment.Exit(-1);
}
我不想在编译时将其注释掉然后再返回.调试时如何使用参数启动程序?它被设置为启动项目.
I don't want to comment it out and and then back in when compiling. How can I start the program with arguments when debugging? It is set as the StartUp Project.
推荐答案
转到 Project->
.然后单击 Debug
选项卡,并在名为 Command line arguments
的文本框中填写您的参数.
Go to Project-><Projectname> Properties
. Then click on the Debug
tab, and fill in your arguments in the textbox called Command line arguments
.
这篇关于调试时如何使用参数启动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文