Reputation: 19870
I have a C# windows service. In that service code, I define Main() and capture various arguments. If the arg is "install" I call code to install the service. Note that when the arg is install, I am not running the service, just installing it, so it seems to me that this is nothing more than a console app at that point.
When I debug the code in vs.net 2012, I see all of my Console.WriteLine() output in the debug window. I believe that is because VS.NET maps STDOUT to the debug window.
But if I open a command prompt and run the command line myservice.exe install
, there is no output to the console window. If I run myservice.exe install > out.txt
I see all of the output in out.txt. What happened and how can I get that Main() code to actually send the output to the console window?
Upvotes: 1
Views: 1116
Reputation: 6464
This could be due to the Output Type of your project; please note that the default Windows Application output type does not automatically show a console window. For this, you may want to change the Output Type to a Console Application.
Upvotes: 4