To create and run a console application

  • Start Visual Studio.
  • On the menu bar, choose File, New, Project.
  • The New Project dialog box opens.
  • Expand Installed, expand Templates, expand Visual C#, and then choose Console Application.
  • The new project appears in Solution Explorer.
  • If Program.cs isn’t open in the Code Editor, open the shortcut menu for Program.cs in Solution Explorer, and then choose View Code.
  • Replace the contents of Program.cs with the following code.

using System;
namespace d2cConsole
class Program
static void Main(string[] args)
Console.WriteLine("Welcome 2");
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");

Choose the F5 key to run the project. A Command Prompt window appears that contains the line Welcome 2

Leave a Reply

Your email address will not be published. Required fields are marked *