发布控制台应用程序

时间:2014-09-15 12:52:29

标签: c# visual-studio visual-studio-2013 console-application

使用Visual Studio 2013发布并运行该文件后,它给出了一个错误...它不接受来自命令行的输入。我确信错误在我的最后,考虑到我对这种方式发布应用程序这么新。任何帮助是极大的赞赏。我发布了以下主要方法的代码...如果更多有用,请告诉我

static void Main(string[] args)
{
    DBAccessManager DBAccess = new DBAccessManager();
    SqlConnection connString = new SqlConnection();

    connString.ConnectionString = System.Configuration.ConfigurationManager
        .ConnectionStrings["HeatConnection"].ToString();

    if(args.Length != 0 && IsOnlyInts(args[0])){
        if(args[1] == "true")
        {
            string UserId = "US" + args[0];
            SearchResult result = DBAccessManager
                .ReadActiveDirectoryEntry(UserId);
            DBAccess.UpdateSQL(connString.ConnectionString, result, UserId);
        }
        else
        {
            Employee SQLresult = DBAccess.ReadUserInformation(
                connString.ConnectionString.ToString(), args[0])[0];

            if (SQLresult != null)
            {
                string LdapServerName = "ServerName";
                DBAccess.UpdateActiveDirectory(LdapServerName, args[0], 
                    SQLresult);
            }
            else
            {
                Console.WriteLine("Customer Id Not Found.");
            }
        }
    }       
    else
    {
        Console.WriteLine("Customer id number must be provided. Only Numbers are allowed");
        Console.WriteLine("Press any key to Continue");
        Console.ReadKey();
    }
}

1 个答案:

答案 0 :(得分:0)

等待和等待后,项目要求发生了变化。所以这不再是一个相关的问题......我将此标记为答案,因此不会被视为需要答案