This documentation is archived and is not being maintained.
Debugging Preparation: Console Applications
Visual Studio .NET 2003
Preparing to debug a C# or Visual Basic Console Application project is similar to preparing to debug a Windows Application project, with a few additional considerations. For more information, see Debugging Preparation: Windows Applications.
- You may need to specify command-line arguments for your console application. For more information, see Project Settings for a Visual Basic Debug Configuration or Project Settings for a C# Debug Configuration. Like all project properties, these arguments persist between debug sessions and between Visual Studio sessions. So, if the console application is one you have debugged previously, remember that there may be arguments from previous sessions in the <Project> Property Pages dialog box.
- To debug a console application, you may need to start your application from the command prompt rather than from Visual Studio. In that case, you can start the application from the command prompt and then attach the Visual Studio debugger to it. For more information, see Attaching to a Running Program or Multiple Programs.
- A console application uses the Console window to accept input and to display output messages. To write to the Console window, your application must use the Console object rather than the Debug object. To write to the Visual Studio Output window, use the Debug object as usual. Be sure you know where your application is writing or you may be looking for messages in the wrong place. For more information, see Console Class, Debug Class, and Output Window.
- When you start a console application from Visual Studio, the Console window sometimes appears behind the Visual Studio window. If you try to start your console application from Visual Studio and nothing seems to happen, try moving the Visual Studio window.