I'm developing a simple console application in Visual Studio 2008 and want to run it in the output window inside Visual Studio 2008, instead of having a separate command prompt window come up. Is there a way to do this?
-
See also: http://blogs.msdn.com/b/csharpfaq/archive/2004/11/30/is-it-possible-to-output-the-command-line-used-to-build-a-project-in-visual-studio.aspx – Cody Gray - on strike Apr 01 '13 at 23:10
5 Answers
If you run the console app in the post build step it's output will go to the output window. The inability to do this easily has been on of my biggest peeves with VS (any version)

- 9,676
- 29
- 53
-
18To do this, in the Solution Explorer, right-click on your project, choose Properties. Go to the Build Events tab and hit 'Edit Post-build ...'. In the new window that opens, hit the 'Macros >>' button and double click on TargetPath so that it appears in the text box. Hit OK and save the project, then Build it. – Sarah Vessels Jun 22 '09 at 16:29
Does it actually have to be a console application? If you make it a WinForms app (even though it doesn't create any GUI elements) you'll get the console output in the Output window. However, you then can't read from console input, and obviously you won't get any output at all if you run from a real command line or in explorer. For simple test applications this may be fine, of course!

- 1,421,763
- 867
- 9,128
- 9,194
-
Basically the same answer was given here: http://stackoverflow.com/questions/2518509/redirect-console-write-methods-to-visual-studios-output-window-while-debuggin – Mark Meuer Feb 01 '11 at 18:04
The only way I know of is to add it as an external tool and tick the Use output window checkbox when you define the tool.

- 11,894
- 12
- 69
- 85
It is a fairly old question, but as there is no answer marked as solution yet, try the answer given over here: Having the output of a console application in Visual Studio instead of the console