C
Chris Mullins
For some reason the question, "Can I make an EXE that is both a Windows
Service and a Console Application?" has come up quite a bit for me over the
last few weeks.
I've been doing this for years, but for some reason I've never seen it
documented anywhere. C# (or VB.Net) is perfectly happy to create an EXE that
can be:
1 - Both a WinForms App or a Windows Service
2 - Both a Console App or a Windows Service
(or, indeed, any combination of the three).
This is typically useful for debugging - it's nice to have a single .EXE
that you can run from the command line (with "-debug"), or start as a
Windows Service. The classic trick of "push the code into a Class and create
two Exe's" always struck me as a bit silly.
I added this, along with the relevant C# souce code, to a blog entry at:
http://www.coversant.com/dotnetnuke/Default.aspx?tabid=88&EntryID=19
Service and a Console Application?" has come up quite a bit for me over the
last few weeks.
I've been doing this for years, but for some reason I've never seen it
documented anywhere. C# (or VB.Net) is perfectly happy to create an EXE that
can be:
1 - Both a WinForms App or a Windows Service
2 - Both a Console App or a Windows Service
(or, indeed, any combination of the three).
This is typically useful for debugging - it's nice to have a single .EXE
that you can run from the command line (with "-debug"), or start as a
Windows Service. The classic trick of "push the code into a Class and create
two Exe's" always struck me as a bit silly.
I added this, along with the relevant C# souce code, to a blog entry at:
http://www.coversant.com/dotnetnuke/Default.aspx?tabid=88&EntryID=19