C#: Is it possible to have a single application behave as Console or Windows application depending on switches?

前端 未结 7 2301
无人及你
无人及你 2020-12-09 21:25

I have a simple application that I would like to sort of automate via switches. But when I do run it via switches I don\'t really want a user interface showing. I just want

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 22:20

    I believe the answer is no, or it was last time I looked into this problem.

    The executable is marked as either a windowed application or a console application. You can see this in the properties for you project in Visual Studio, under application, Output type

    You could simulate the behavior by having two application, a console application that if executed with no arguments launches the GUI application. You may see a console window flash, unless you ran in from an already open console.

提交回复
热议问题