如何调试时,我开始带有参数的程序? [英] How do I start a program with arguments when debugging?

查看:135
本文介绍了如何调试时,我开始带有参数的程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在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.

推荐答案

项目 - ><项目名>属性。然后点击调试标签,并在所谓的文本框中填写您的参数命令行参数

Go to Project-><Projectname> Properties. Then click on the Debug tab, and fill in your arguments in the textbox called Command line arguments.

这篇关于如何调试时,我开始带有参数的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆