Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# publishing an .exe and sending params to it using cmd

i am pretty sure this is basic but i just dont success to do this i am trying to create a console application that would do ABC by getting few arguments

for start i am trying to run something as simple as that

static void Main(string[] args)
{
    foreach (var s in args)
    {
        Console.WriteLine(s);
    }
    Console.ReadLine();
} 

when i publish it it comes at as a 'clickonce' project like NAME.application instead of NAME.exe

also , when i am trying to go execute it with XYZ parms like trying in same folder in command line

NAME.application agr1 agr2 agr3

it just opens the application with empty console :(

like image 247
Itay Avatar asked Dec 05 '10 09:12

Itay


1 Answers

The .application file is not your executable file, but a file used for the deployment. So when running the program locally, you should still run the .exe. file. Check here for some info about command line arguments and ClickOnce: "Simulating command line parameters in Click Once applications"

like image 87
Fredrik Mörk Avatar answered Sep 25 '22 13:09

Fredrik Mörk