VS Code — Complete .NET Setup Guide
What is VS Code?
Visual Studio Code (VS Code) is a free, lightweight, open-source code editor built by Microsoft. Unlike Visual Studio (the full IDE), VS Code is a fast, minimal editor extended with plugins — making it highly customizable for any language or platform including C# and .NET.
Why Use VS Code?
VS Code launches in under 2 seconds, runs on Windows, Mac, and Linux, and uses far less RAM than Visual Studio. It is the most popular code editor in the world (Stack Overflow survey, 7 years running).
Where is it Used?
| Scenario | Use |
|---|---|
| ASP.NET Core Web API development | ✅ With C# Dev Kit |
| Microservices and Docker | ✅ Lightweight, fast |
| Linux/Mac development | ✅ Cross-platform |
| Frontend (Angular/React) + Backend | ✅ One editor for both |
| Remote development (SSH) | ✅ Remote extensions |
Key Benefits
- Fast — opens instantly, even large projects
- Free & open source — no license cost
- Cross-platform — same experience on Windows, Mac, Linux
- Huge extension library — 50,000+ extensions for any tool or language
- Built-in terminal — run
dotnetcommands without switching windows - REST Client extension — test APIs directly inside VS Code
- Git integration — stage, commit, push from the sidebar
VS Code is great for .NET APIs, microservices, and cross-platform development.
Install VS Code
Download: code.visualstudio.com
Essential Extensions
| Extension | Purpose | Install |
|---|---|---|
| C# Dev Kit | IntelliSense, project mgmt, test explorer | Required |
| .NET Install Tool | Manage .NET SDK versions | Required |
| GitLens | Git blame, history, annotations | Strongly recommended |
| REST Client | Test HTTP APIs inside VS Code | Recommended |
| Thunder Client | Postman-like GUI inside VS Code | Recommended |
| SQL Server (mssql) | Connect to SQL Server, run queries | Recommended |
| Error Lens | Show errors inline next to code | Recommended |
| Bracket Pair Colorizer | Color-matched brackets | Nice to have |
Install C# Dev Kit: Ctrl+Shift+X → search "C# Dev Kit" → Install
⌨️ Essential Keyboard Shortcuts
File and Navigation
| Shortcut | Action |
|---|---|
Ctrl+P | Quick open file |
Ctrl+Shift+P | Command palette |
Ctrl+Tab | Switch between open files |
Ctrl+G | Go to line number |
F12 | Go to definition |
Alt+F12 | Peek definition |
Shift+F12 | Find all references |
Ctrl+Shift+F | Search across all files |
Ctrl+B | Toggle sidebar |
Code Editing
| Shortcut | Action |
|---|---|
Ctrl+. | Quick fix / suggestions |
F2 | Rename symbol (refactor) |
Alt+Shift+F | Format document |
Ctrl+/ | Toggle line comment |
Ctrl+Shift+/ | Toggle block comment |
Alt+Up/Down | Move line up/down |
Shift+Alt+Up/Down | Copy line up/down |
Ctrl+D | Select next occurrence |
Ctrl+Shift+L | Select all occurrences |
Ctrl+L | Select entire line |
Ctrl+X | Cut line (no selection = cut whole line) |
Terminal and Running
| Shortcut | Action |
|---|---|
Ctrl+`` `` | Toggle integrated terminal |
Ctrl+Shift+`` `` | New terminal |
F5 | Start debugging |
Shift+F5 | Stop debugging |
Ctrl+Shift+B | Run build task |
F9 | Toggle breakpoint |
F10 | Step over |
F11 | Step into |
Multi-cursor (Power Feature)
| Shortcut | Action |
|---|---|
Alt+Click | Add cursor at click position |
Ctrl+Alt+Down | Add cursor below |
Ctrl+Alt+Up | Add cursor above |
Ctrl+Shift+Alt+Arrow | Column/box selection |
settings.json
Ctrl+Shift+P → "Open User Settings (JSON)":
{
"editor.fontSize": 14,
"editor.fontFamily": "'JetBrains Mono', 'Cascadia Code', Consolas, monospace",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.rulers": [120],
"editor.bracketPairColorization.enabled": true,
"editor.minimap.enabled": false,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"terminal.integrated.defaultProfile.windows": "PowerShell",
"editor.stickyScroll.enabled": true,
"[csharp]": {
"editor.defaultFormatter": "ms-dotnettools.csharp"
}
}
Debugging in VS Code
Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch SchoolManagement API",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}/SchoolManagementApi.csproj",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
]
}
REST Client Extension — Test APIs Without Postman
Create api-tests.http:
@baseUrl = http://localhost:5001
@token = eyJhbGciOiJIUz...
### Login
POST {{baseUrl}}/api/auth/login
Content-Type: application/json
{
"email": "admin@nexcoding.in",
"password": "Admin@123"
}
### Get all students
GET {{baseUrl}}/api/students
Authorization: Bearer {{token}}
### Enroll student
POST {{baseUrl}}/api/students
Content-Type: application/json
Authorization: Bearer {{token}}
{
"name": "Ravi Kumar",
"className": "10th"
}
Click Send Request above each block → response appears in split panel.
VS Code Interview Questions
Q1: What is C# Dev Kit and why is it needed?
C# Dev Kit is the official Microsoft extension for C# in VS Code.
Provides IntelliSense, debugging, test explorer, Solution Explorer.
Without it, VS Code has no understanding of C# code.
Q2: How do you debug a .NET app in VS Code?
1. Create .vscode/launch.json (or let C# Dev Kit generate it)
2. Set breakpoints (F9)
3. Press F5 to start debugging
4. Use F10/F11 to step through code
Q3: VS Code vs Visual Studio — when to use which?
VS Code → APIs, microservices, Linux/Mac, lightweight, cross-platform
Visual Studio → Full .NET apps, WPF/WinForms, Designer tools, deeper debugging
Use ChatGPT, Claude, or Copilot to go deeper on VS Code setup for .NET C# development. Try these prompts:
"What is the most important VS Code extension for C# development and what does it do?""How do I use the REST Client extension to test my API?""What VS Code shortcuts should every C# developer memorize?""How do I set up debugging for an ASP.NET Core project in VS Code?"
💡 Tip: After reading this article, paste your own code into AI and ask "What could go wrong here and why?" — fastest way to find edge cases and deepen understanding.