← Open in the full interactive course (progress tracking, search & more)

Everything you need to install, configure, and run your first C# application with .NET 10.

Imagine you've just bought the most powerful power tools in the world — but they're still in the box, and you don't have a workbench.

You can't build anything until you set up your workshop.

That's exactly where we are right now. You've learned what C# and .NET are. Now it's time to set up your development environment — the workshop where you'll write, build, and run C# code.

By the end of this page, you'll have a fully working .NET 10 environment on your machine, and you'll have run your very first C# program.

What Is the .NET Development Environment?

The Simple Explanation

Your development environment is the set of tools you use to write and run C# code. It includes:

The Technical Definition

.NET SDK (Software Development Kit) is a collection of tools, libraries, and runtime components that allow you to create, build, and run .NET applications. It includes:

.NET SDK + VS Code + C# Extensions = Ready to Build
Three pieces, one complete workshop.

Why Do We Need to Set This Up?

The Problem

If you just write C# code in a plain text file, your computer doesn't know what to do with it. It's like handing a builder a blueprint with no tools, materials, or instructions. The builder needs:

The Solution

The .NET SDK and a good code editor provide everything you need in one cohesive package.

The key insight

Setting up your environment once means you can build any .NET application — from console apps to web APIs to mobile apps — using the same core tools.

Big Picture — What We're Building

Here's the complete setup we'll create:

YOUR MODERN .NET WORKSHOP
STEP 1 — Install .NET 10 SDK
The engine that compiles and runs your C# code
STEP 2 — Install VS Code
A lightweight, powerful code editor
STEP 3 — Install C# Extensions
Intellisense, debugging, and project management
STEP 4 — Create Your First Project
Use dotnet new console to generate a template
STEP 5 — Run Your App
dotnet run — see "Hello, World!" in the terminal

How It Works — Step by Step

Step 1 — Install the .NET 10 SDK

Go to dotnet.microsoft.com/download and download the .NET 10 SDK for your operating system (Windows, macOS, or Linux).

Download .NET 10 SDK Run the installer Installed

Verify it's installed correctly by opening a terminal (Command Prompt, PowerShell, or Terminal) and running:

dotnet --version

You should see something like 10.0.100 (or a similar 10.x version).

Step 2 — Install Visual Studio Code

VS Code is a free, lightweight code editor that works on all platforms. Download it from code.visualstudio.com.

Download VS Code Install & launch

Step 3 — Install C# Extensions

Open VS Code, click the Extensions icon (left sidebar, looks like four squares), and search for:

C# Dev Kit + .NET Extension Pack IntelliSense, debugging, project management

Step 4 — Create Your First Project

Open a terminal (in VS Code: Terminal → New Terminal) and run:

dotnet new console -n MyFirstApp

This creates a new folder called MyFirstApp with a complete C# console application.

dotnet new console MyFirstApp/ + Program.cs + MyFirstApp.csproj

Step 5 — Run Your App

Navigate into the project folder and run it:

cd MyFirstApp
        dotnet run

You should see:

Hello, World!

You've just written and run your first C# program!

Simple Example — Your First Program

When you run dotnet new console, it generates a Program.cs file that looks like this (using the modern top‑level statements syntax in .NET 10 / C# 14):

// Program.cs — Your first C# program
            Console.WriteLine("Hello, World!");

What's happening here?

In .NET 10 (C# 14), the compiler automatically generates the Main method entry point behind the scenes, so you don't have to write it yourself. This is called top‑level statements — a modern convenience that keeps your code clean.

Project Structure Breakdown

MyFirstApp/
Project root folder
├── Program.cs
Your C# source code
├── MyFirstApp.csproj
Project file — defines dependencies and settings
├── obj/
Temporary build files (don't edit)
└── bin/
Built output (DLLs, EXEs) — the compiled application

Real‑World Example — Building an E‑Commerce API

Imagine you're building a backend API for an online store. Your development environment would look like this:

This same setup — one SDK, one editor, one set of tools — powers everything from tiny console utilities to massive enterprise systems serving millions of users.

Analogy — Setting Up a Kitchen

Think of setting up your .NET environment like preparing a kitchen before cooking a big meal.

.NET SDK
→ The oven, stovetop, and refrigerator — the essential appliances that make cooking possible
VS Code
→ The kitchen counter and prep area — where you do the actual work
C# Extensions
Knives, measuring cups, and spatulas — the specialized tools that make prep easier and faster
dotnet CLI
→ The recipe book and timer — guides you through the steps and keeps you on track
Together
→ You can cook anything — from a simple snack to a multi‑course feast

Without the SDK, you have no "appliances" — your code can't run. Without VS Code, you have no "work surface" — writing code is clumsy. Without extensions, you're using dull knives — everything takes longer. All three pieces work together to make you productive.

Under the Hood — What dotnet run Actually Does

When you type dotnet run in your terminal, a whole chain of events happens behind the scenes:

WHAT HAPPENS WHEN YOU RUN dotnet run
1. RESTORE (if needed)
2. BUILD
3. EXECUTE
4. OUTPUT

Important: The build and run steps happen in separate phases. You can also run dotnet build to compile without executing, and dotnet run --no-build to run without recompiling.

Common Confusion

SDK vs Runtime — What's the Difference?

This is a very common confusion. Let's clear it up:

.NET SDK ≠ .NET Runtime

.NET SDK — For developers. Includes compilers, project templates, CLI tools, and the runtime. You need this to build code.

.NET Runtime — For end users. Only includes what's needed to run applications, not to build them. Smaller and lighter.

Correct relationship: As a developer, you install the SDK. It includes the Runtime. For production servers, you typically install only the Runtime (or the ASP.NET Core Runtime for web apps).

Common wrong thinking: "I installed the .NET Runtime, why can't I run dotnet new?" — because dotnet new is an SDK command, not a runtime command.

VS Code vs Visual Studio — Which One?

Feature VS Code Visual Studio
SizeLightweight (~200 MB)Heavy (~20+ GB)
PlatformWindows, macOS, LinuxWindows (macOS has a separate product)
Best forWeb, cloud, microservices, cross‑platformLarge enterprise, desktop, Windows‑focused
Recommendation Start hereGreat for advanced Windows development

Common Mistakes

Mistake 1 — Installing the Runtime instead of the SDK

Wrong: Downloading ".NET Runtime" and wondering why dotnet new doesn't work
Correct: Download the .NET SDK — it includes everything you need

Mistake 2 — Forgetting to reload VS Code after installing the SDK

Wrong: Installing the SDK but seeing errors in VS Code
Correct: Close and reopen VS Code (or reload the window) so it picks up the new SDK path

Mistake 3 — Not using the terminal inside VS Code

Wrong: Opening a separate terminal window and navigating to the project
Correct: Use Terminal → New Terminal in VS Code — it automatically opens in your project folder

Mistake 4 — Ignoring the obj/ and bin/ folders

Wrong: Editing files in obj/ or bin/
Correct: Only edit source files (Program.cs). The obj/ and bin/ folders are generated by the compiler — never edit them manually.

When Should I Use This Setup?

This setup is perfect for:

Consider a different setup for:

Mental Model

.NET SDK = The Engine + Toolbox
    └── Compiler (csc): Turns C# into IL
    └── CLR: Runs the code
    └── BCL: Pre‑built parts
    └── dotnet CLI: Your control panel

VS Code + Extensions = Your Workbench

Together = Write → Build → Run → Ship

Remember:

Key Takeaway


Check Your Understanding

You've set up your environment and run your first program. Let's make sure you understand the tools and commands.

1. You've just installed the .NET Runtime, but when you try to run dotnet new console, you get an error saying the command is not recognised. What is the most likely reason?

Show answer

Correct: A

Why A is correct: The .NET SDK includes the full set of development tools, including the dotnet new template command. The .NET Runtime only includes what's necessary to run applications — it doesn't include the compiler, project templates, or SDK‑specific CLI commands.

Why B is incorrect: A restart is rarely needed for .NET installations. The PATH environment variable is usually updated by the installer without requiring a reboot.

Why C is incorrect: The .NET Runtime is cross‑platform — it runs on Windows, macOS, and Linux.

Why D is incorrect: You don't need Visual Studio to use the .NET SDK. VS Code (or even a text editor) is sufficient for development.

Reinforcement: As a developer, always install the SDK, not just the Runtime. The SDK includes the Runtime plus the compiler, templates, and tools you need to build applications.

2. You're working on a project and you see a bin/ folder and an obj/ folder in your project directory. What should you do with these?

Show answer

Correct: B

Why B is correct: bin/ and obj/ are automatically generated by the .NET build system. obj/ contains temporary build artifacts, and bin/ contains the compiled output (DLLs, EXEs). They are re‑generated on every build and should never be edited manually.

Why A is incorrect: Editing these files manually can corrupt your build or lead to unexpected behaviour. They are not meant to be user‑editable.

Why C is incorrect: Deleting them is safe (they'll be recreated on the next build), but there's no benefit to doing so — they don't slow down your IDE. In fact, build tools use them for incremental builds.

Why D is incorrect: You should not add bin/ or obj/ to version control (Git). They are build outputs and vary between machines and builds. They should be in your .gitignore file.

Reinforcement: Only edit source files like Program.cs. The build system handles bin/ and obj/ for you. This keeps your project clean and reproducible.

3. You're building a new C# web API for a startup. The app needs to run on Linux servers in the cloud. Which setup should you use?

Show answer

Correct: B

Why B is correct: VS Code with the .NET 10 SDK is the ideal setup for modern, cross‑platform development. .NET 10 (and .NET 5+) is fully cross‑platform — you can build on Windows, macOS, or Linux and deploy to any of them. The SDK includes all the tools you need for development.

Why A is incorrect: The .NET Framework is Windows‑only and outdated for new development. You want .NET (5+) for cross‑platform support.

Why C is incorrect: .NET Core 3.1 is outdated and no longer supported. .NET 10 is the current, supported version with the latest features and security updates.

Why D is incorrect: The Runtime alone doesn't include the SDK tools you need to build the application. You need the SDK for development, even if you eventually deploy only the Runtime.

Reinforcement: For new projects, always use the latest version of .NET (currently .NET 10) and a modern, cross‑platform setup like VS Code + .NET SDK. This gives you the most flexibility for deployment.

4. Which command would you use to create a new console application called MyCalculator?

Show answer

Correct: C

Why C is correct: dotnet new console -n MyCalculator is the correct syntax. -n (or --name) specifies the project name, which becomes the folder name and the default namespace.

Why A is incorrect: dotnet new console MyCalculator doesn't use the correct syntax — the name parameter requires the -n flag.

Why B is incorrect: dotnet create is not a valid command. The correct command is dotnet new.

Why D is incorrect: dotnet new project is not a valid template name. The template is console, and the syntax for the name flag is -n.

Reinforcement: The dotnet new command is your primary tool for creating new projects. Use dotnet new <template> -n <ProjectName> to create a project with a specific name.

5. You've made changes to your Program.cs file and want to see the updated output. You're currently in the project folder. What's the quickest way to see your changes?

Show answer

Correct: B

Why B is correct: dotnet run automatically builds your code (if needed) before executing it. You don't need to run dotnet build separately — dotnet run handles both steps. This is the quickest way to see your changes.

Why A is incorrect: While running dotnet build then dotnet run would work, it's extra typing. dotnet run does both steps automatically.

Why C is incorrect: dotnet start is not a valid .NET CLI command.

Why D is incorrect: Restarting VS Code is unnecessary and inefficient. The build and run commands work fine without restarting the editor.

Reinforcement: dotnet run is your one‑stop command for building and running. It's the fastest way to iterate on your code during development.

Your .NET workshop is ready! You have everything you need to start building real applications.


dotnetmadeeasy.com — Learn C# and .NET, the right way.