c# - 调试时如何启动带有参数的程序?

标签 c# visual-studio visual-studio-2008 visual-studio-debugging

我想在 Visual Studio 2008 中调试一个程序。问题是如果它没有获取参数,它就会退出。这是来自主要方法:

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);
}

我不想在编译时将其注释掉然后再返回。调试时如何使用参数启动程序?它被设置为启动项目。

最佳答案

转到 Project-><Projectname> Properties .然后点击Debug选项卡,并在名为 Command line arguments 的文本框中填写您的参数.

关于c# - 调试时如何启动带有参数的程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4791140/

相关文章:

.net - 如何正确修改生成的XSD以克服导致异常 "cs0030:Unable to generate a temporary class"的已知.Net错误

c# - Linq to SQL FirstOrDefault 不执行 SQL 查询

c++ - C/C++ - 预编译 header - 封装、如何以及为什么需要配置?

c# - 如何检查 $(ConfigurationName) 是否包含字符串

.net - Telerik Rad 文本框和 javascript 问题

c# - 有没有办法在 Visual Studio 中不创建显式 EventHandler 委托(delegate)?

c# - 错误 : Index out of range exception unhandled and Operator '*' cannot be applied to operands of type 'object' and 'int'

c# - WCF WebInvoke JSON 反序列化失败 - 400 错误请求

c# - 有 xmlns= 时如何查找 XML 节点

c++ - 什么是 RPC 回调线程?