5

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

Itay
  • 53
  • 1
  • 3

2 Answers2

3

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"

Fredrik Mörk
  • 155,851
  • 29
  • 291
  • 343
3

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.

PHeiberg
  • 29,411
  • 6
  • 59
  • 81
  • isnt doing this wont let me enable the application on computers without .net framework? – Itay Dec 05 '10 at 10:05
  • @Itay: using xcopy deployment does not bring any of the advanced scenarios that ClickOnce and Windows Installer holds. If you need the .NET framework to be installed as part of the installation process you need to look at either ClickOnce or Windows Installer. See this for guidance: http://msdn.microsoft.com/en-us/library/e2444w33.aspx – PHeiberg Dec 06 '10 at 07:00