Create a C# Project in Visual Studio Code

This procedure walks you through creating a new C# console project in Visual Studio Code using the C# Dev Kit extension.

Prerequisites#

Steps#

  1. Open Visual Studio Code.
  2. Open the Explorer panel by clicking the file icon in the left sidebar.
  3. Click Open Folder and choose a folder for your project, or create a new one.
  4. Open the Command Palette with Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac).
  5. Type .NET: New Project and select it from the list.
  6. Select Console App from the project templates.
  7. Enter a name for your project and press Enter.
  8. Confirm the folder where the project will be created and press Enter.
  9. When prompted for the solution file format, select .sln and press Enter.

Result#

Your project folder will contain:

  • Program.cs — the file where you write your code
  • <ProjectName>.csproj — the C# project configuration file
  • <SolutionName>.sln — the solution file

Open Program.cs to start coding. You should see a single line that prints Hello, World! — this means the project was created successfully.

Common Mistakes#

Not completing the procedure in one go The .NET: New Project wizard runs as a sequence of prompts in the Command Palette. If you close it at any point — by pressing Escape or clicking away — the wizard resets and no files are created. Start from step 4 again and work through all the prompts without interruption.

Opening the wrong folder first The project is created inside whichever folder is open in VS Code. If you open the right folder but then navigate away, or if you skip step 3 entirely, the project may end up in an unexpected location. Always confirm the folder shown in step 8 before pressing Enter.

Choosing the wrong project template Select Console App, not Class Library, ASP.NET Core Web App, or any other template. The other templates produce different project structures with different entry points. If you chose the wrong one, delete the generated files and start from step 4.

Resources#