Hide Console Window in C# Console Application

2019-01-30 03:25发布

The thing is, i really dont want the console window to show up...but the solution should be running. My point here is, I want to keep the application running in the background, without any window coming up.

5条回答
叛逆
2楼-- · 2019-01-30 03:58

Change the output type from Console Application to Windows Application,

And Instead of Console.Readline/key you can use new ManualResetEvent(false).WaitOne() at the end to keep the app running.

查看更多
Emotional °昔
3楼-- · 2019-01-30 04:07

Change your application type to a windows application. Your code will still run, but it will have no console window, nor standard windows window unless you create one.

查看更多
放我归山
4楼-- · 2019-01-30 04:20

Instead of Console.Readline/key you can use new ManualResetEvent(false).WaitOne() at last. This works well for me.

查看更多
叼着烟拽天下
5楼-- · 2019-01-30 04:21

Change the output type from Console Application to Windows Application. This can be done under Project -> Properties -> Application in Visual Studio:

alt text

查看更多
smile是对你的礼貌
6楼-- · 2019-01-30 04:21

Maybe you want to try creating a Windows Service application. It will be running in the background, without any UI.

查看更多
登录 后发表回答