How to organize the launch of the application from the command line? Suppose we have a ZipApp application that uses the parameters run, name1 and name2. I want to be able to run the program from the command line in two versions:
"C: / Program / ZipApp zip file1 archive1" or "C: / Program / ZipApp unzipping arhive1 file1"
Here is a sketch of the code that does not work:
void Main(string[] args) { if (args[0] != null && args[1] !=null & args[2] != null) { string run = args[0]; string name1 = args[1]; string name2 = args[2]; switch (run) { case "zipping": string ZipFileName = name1; string ZipArchName = name2; Console.WriteLine("Создаём архив из файла {0} в архив {1}", ZipFileName,ZipArchName); Zipping(ZipFileName, ZipArchName); break; case "unzipping": string UnZipArchName = name1; string UnZipFileName = name2; Console.WriteLine("Разархивируем архив {0} в файл {1}",UnZipArchName,UnZipFileName); Unzipping(UnZipArchName, UnZipFileName); break; } } else { Console.WriteLine("Параметры запуска не указаны или указаны не верно"); } Console.ReadLine(); } the trouble is that when you try to start an application from VS, the compiler swears:
Program does not contain a static 'Main' method suitable for entry point Tell me what am I doing wrong?
