By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,894 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,894 IT Pros & Developers. It's quick & easy.

Hybrid Windows Service + Console App

P: n/a
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:
Chris Mullins MCSD.Net, MCPD Enterprise
Sep 28 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.