Beginner 7 min read

VS Code + C# Dev Kit

Set up VS Code, C# Dev Kit, extensions, tasks and launch.json.

VS Code + C# Dev Kit: A Beginner's Guide to .NET Development

Visual Studio Code (VS Code) is a lightweight, cross-platform code editor that supports C# and .NET development through extensions and command-line tools. Unlike the full Visual Studio IDE, VS Code provides a flexible editing environment that you can customize for your development workflow.

With the C# Dev Kit extension, the .NET SDK, and a few essential tools, you can create C# applications, manage projects, build solutions, and debug code directly from VS Code. Understanding these tools is useful when working with ASP.NET Core, Web APIs, console applications, and other .NET projects.

1. Installing VS Code and the .NET SDK

Before creating a C# project, install Visual Studio Code and the .NET SDK.

Run these commands:

dotnet --version
dotnet --list-sdks

The first command displays the selected SDK version, while the second lists the SDKs installed on your machine.

Why is the .NET SDK necessary? VS Code is primarily a code editor. The .NET SDK provides the command-line tools needed to create projects, restore dependencies, compile applications, run tests, and execute .NET programs.

2. Installing C# Dev Kit and Essential Extensions

Extensions add programming language support and development features to VS Code. For C# development, the most important starting point is Microsoft's C# Dev Kit.

Open the Extensions view using Ctrl + Shift + X, search for the extension, and install it.

Extension or toolPurpose
C# Dev KitAdds C# project management, solution exploration, and integrated development features.
C#Provides C# language support, IntelliSense, and debugging integration.
.NET Install ToolHelps acquire supported .NET SDKs and runtimes when needed.
NuGet GalleryAn optional extension for browsing NuGet packages from within VS Code.

Some dependencies may be installed automatically with C# Dev Kit. Check the extension descriptions and requirements before installing additional tools.

For beginners, start with C# Dev Kit and the .NET SDK. Add other extensions only when they solve a specific development need.

3. Creating Your First C# Project

VS Code supports project creation through the .NET CLI, making it easy to start a new application without navigating through graphical project templates.

To create a console application, open the integrated terminal using Ctrl + ` and run:

dotnet new console -n FirstDotNetApp
cd FirstDotNetApp
code .

This creates a console project, moves into its directory, and opens the project in VS Code.

Run the application:

dotnet run

The default application prints a message to the terminal. Open Program.cs to explore the generated C# code.

You can also create an ASP.NET Core Web API using:

dotnet new webapi -n MyFirstApi
cd MyFirstApi
dotnet run

The generated project provides a starting point for building HTTP endpoints. The exact template contents depend on the installed SDK and selected options.

4. Understanding tasks.json in VS Code

The tasks.json file defines reusable tasks such as building a project, running scripts, or executing other command-line operations. Instead of repeatedly typing commands in the terminal, you can run configured tasks directly from VS Code.

For example, create a .vscode folder in your project and add a tasks.json file:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build .NET Project",
      "type": "process",
      "command": "dotnet",
      "args": [
        "build"
      ],
      "problemMatcher": "$msCompile",
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}

Press Ctrl + Shift + B to execute the default build task.

This configuration runs dotnet build and allows VS Code to recognize supported compiler diagnostics. For a project with multiple project files, make sure the task runs from the intended working directory.

5. Understanding launch.json for Debugging

The launch.json file defines how VS Code starts or attaches to a program during debugging. It can specify the executable, command-line arguments, environment variables, and other debugging options.

For many .NET projects, C# Dev Kit can generate the required debugging configuration when you select Run and Debug and choose an appropriate C# debugging option.

A typical .vscode/launch.json configuration for a console application looks like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": ".NET Launch",
      "type": "coreclr",
      "request": "launch",
      "preLaunchTask": "build",
      "program": "${workspaceFolder}/bin/Debug/net10.0/FirstDotNetApp.dll",
      "args": [],
      "cwd": "${workspaceFolder}",
      "console": "integratedTerminal",
      "stopAtEntry": false
    }
  ]
}

Important: This example assumes that the project targets .NET 10 and that its assembly is named FirstDotNetApp.dll. Change net10.0 to your project's actual target framework and update the assembly name when necessary.

The preLaunchTask property connects the debugger to the task named build. If you use the earlier task configuration, change "build" to "Build .NET Project" or rename the task accordingly.

For many projects, allowing C# Dev Kit to generate the debugging configuration is easier and less error-prone than writing launch.json manually.

6. Debugging C# Applications in VS Code

Debugging helps you understand how your code executes and identify problems that are difficult to diagnose by reading the source code alone.

To debug a C# application:

  1. Open the project folder in VS Code.
  2. Open Program.cs or another C# source file.
  3. Click beside a line number to set a breakpoint.
  4. Open Run and Debug from the Activity Bar.
  5. Select the appropriate launch configuration.
  6. Press F5 to start debugging.
  7. Inspect variables and use the debugging controls to step through the code.

When execution reaches a breakpoint, you can inspect local variables, evaluate expressions, and follow the program's execution flow.

For ASP.NET Core applications, debugging is particularly useful for investigating controller actions, service methods, request data, and exceptions.

7. Useful VS Code Shortcuts for C# Developers

Learning a few keyboard shortcuts makes everyday development tasks faster.

ShortcutAction
Ctrl + Shift + XOpen Extensions.
Ctrl + Shift + POpen the Command Palette.
Ctrl + `Open or close the integrated terminal.
Ctrl + Shift + BRun the default build task.
F5Start or continue debugging.
F9Toggle a breakpoint.
F10Step over a statement while debugging.
F11Step into a method while debugging.
Shift + F11Step out of the current method.
Ctrl + PQuickly open a file.
Ctrl + Shift + FSearch across project files.
Shift + Alt + FFormat the current document.

Shortcuts may vary depending on your operating system, keyboard configuration, and installed extensions.

Key Takeaways

  • VS Code is a lightweight editor that supports C# and .NET development through extensions and the .NET SDK.
  • C# Dev Kit adds project management and development features for working with C# projects.
  • The .NET CLI provides commands for creating, building, running, and testing applications.
  • tasks.json defines reusable build and automation tasks.
  • launch.json configures debugging sessions when explicit launch configuration is needed.
  • Breakpoints and debugging controls help you understand application behavior and troubleshoot errors.

Frequently Asked Questions

Is VS Code enough for .NET development?

Yes. With the .NET SDK and appropriate extensions, VS Code can support C# development, ASP.NET Core applications, debugging, and testing. Some workflows may be more convenient in the full Visual Studio IDE.

What is the difference between VS Code and Visual Studio?

Visual Studio is a full-featured IDE with integrated project management and development tools. VS Code is a lightweight, extensible editor that relies on extensions and command-line tools for many development workflows.

What is the difference between tasks.json and launch.json?

tasks.json defines commands such as building an application. launch.json defines how a debugger starts or attaches to an application. A launch configuration can use preLaunchTask to run a build task before debugging.

Do I need C# Dev Kit to write C# code in VS Code?

C# Dev Kit is recommended for its additional project management and development features, but other supported C# tooling can provide language support and debugging capabilities without it.

Can I develop ASP.NET Core Web APIs in VS Code?

Yes. You can create an ASP.NET Core Web API using dotnet new webapi, run it with dotnet run, and debug it using the available C# debugging tools.

Related Topics

  • Visual Studio 2026: Beginner's Guide
  • Introduction to .NET and C#
  • .NET SDK and CLI Fundamentals
  • Project Structure in ASP.NET Core
  • Debugging and Exception Handling in C#
  • Dependency Injection in ASP.NET Core

Last updated 10/26/2026

Your notes

Sign in to save personal notes on this topic — they'll sync across your devices.

Was this tutorial helpful?

Help us create more free learning resources. Learn more

Make a Donation