Sha Le
Sha Le

Reputation: 11

C# Console-less application

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.

Upvotes: 1

Views: 873

Answers (3)

Mike Marshall
Mike Marshall

Reputation: 7850

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
    }
 }

Upvotes: 0

Jeff Sternal
Jeff Sternal

Reputation: 48583

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.

Upvotes: 8

Brosto
Brosto

Reputation: 4565

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.

Upvotes: 2

Related Questions