开发者

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 :(


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"


By "publishing" your application from Visual Studio, you are making it into a ClickOnce application. If you only need a simple command line application without the ClickOnce features, just deploy your application using xcopy. That is, just copy the exe and dll files from your bin directory to any directory on the computer where you want to "deploy" it.

In case you need it to be a ClickOnce application, refer to @Fredrik Mörk and @taspeotis answers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜