简体   繁体   中英

How do I create a C# program without a GUI?

I know that you can create a Windows Forms application and set it to be invisible. And if I create a console application (the console window will open- and I have no use for the console), how do I create a simple application that has no GUI at all?

Create a windows application, remove the Form1.cs file, edit the Program.cs file to remove the lines

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());

Put your own code instead, and you're done.

You could create it as a windows service .

This question also has some options for running an existing console application with no console window, so you could write a console application, then write a console application which launches that with its window hidden and then closes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM