Dotnet Run

Run a C# Project in Visual Studio Code

This procedure walks you through running a C# console program in Visual Studio Code using the terminal.

Prerequisites#

Steps#

  1. Open Visual Studio Code with your project folder open.
  2. Open the built-in terminal with Ctrl+\`` (Windows/Linux) or Cmd+`` (Mac). You can also go to View → Terminal.
  3. Make sure the terminal is in your project folder — you should see the folder name in the terminal prompt. If not, navigate to it with cd folder-name.
  4. Save any unsaved changes with Ctrl+S (Windows/Linux) or Cmd+S (Mac).
  5. Run the program with:
dotnet run

Result#

The program builds and runs. Its output appears in the terminal directly below the dotnet run command.

Running a Program

Running a program means telling the computer to execute the instructions in your code, one by one, from start to finish.

What Happens When You Run a Program#

When you run a program, the computer reads your source code and starts executing it from the beginning. Each instruction is carried out in order. If the program asks for input, execution pauses until the user responds. If the program produces output, it appears immediately. When the last instruction is done, the program exits.