1

Am wondering is there anything called Console-less application with same features of console.

Detail: I like to write an application, where I can call the application (myapp.exe arg1 arg2), but don't want any console to show up. All it does is generating an .ASX file. Am currently calling this application from Windows Media Center, so I don't want console to show up.

Any thoughts and suggestions? Thanks.

Sha Le
  • 11
  • 2
  • See the "Related" questions, including http://stackoverflow.com/questions/934901/net-console-application-that-doesnt-bring-up-a-console – Jim Mischel Dec 10 '10 at 16:53
  • Thanks for all the answers. Ended up converting console to a web page, which would generate the ASX playlist. In that way am not dealing with console applications. Thanks again. – Sha Le Dec 14 '10 at 20:00

3 Answers3

8

In your project properties, change the output type to 'Windows Application' and select your Program class as your startup object (or whichever class contains your Main method).

To do it from scratch, just create a Windows Application, delete the form the template creates by default, and modify your Main method to run your code.

Jeff Sternal
  • 47,787
  • 8
  • 93
  • 120
2

You could try something like this.

Another thing to consider is that even form applications can accept parameters. You could either just not open up a form, or hide it to begin with.

Kirk Woll
  • 76,112
  • 22
  • 180
  • 195
Brosto
  • 4,445
  • 2
  • 34
  • 51
0

In Visual Studio 2005 (.NET 2.0) and above, you can just create a Windows Forms application and then pull the form display out of the Program.Main method and put your logic there:

static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        //Application.EnableVisualStyles();
        //Application.SetCompatibleTextRenderingDefault(false);
        //Application.Run(new Form1());

        // TODO: Your logic here
    }
 }
Mike Marshall
  • 7,788
  • 4
  • 39
  • 63