Install .NET 10 and Set Up Your C# Development Environment
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 .NET SDK — The engine that builds and runs your code
- A code editor — Where you write your code (VS Code, Visual Studio, or Rider)
- Extensions / plugins — Extra tools that make coding easier
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:
- The CLR (Common Language Runtime) — executes your code
- The BCL (Base Class Library) — pre‑built code for common tasks
- The compiler (csc) — translates C# to IL
- The dotnet CLI — command‑line tools for creating, building, and running projects
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:
- A way to understand your code (compiler)
- A way to run your code (runtime)
- Pre‑built parts to avoid reinventing everything (class library)
- A place to write your code (editor)
The Solution
The .NET SDK and a good code editor provide everything you need in one cohesive package.
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:
dotnet new console to generate a template
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).
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.
Step 3 — Install C# Extensions
Open VS Code, click the Extensions icon (left sidebar, looks like four squares), and search for:
- "C# Dev Kit" — Microsoft's official extension pack (includes C# extension, IntelliCode, and more)
- Alternatively, install the "C#" extension by Microsoft directly
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.
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?
Console.WriteLine— A built‑in .NET method that prints text to the terminal"Hello, World!"— The text we want to display- The
;— Every C# statement ends with a semicolon
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/├── Program.cs├── MyFirstApp.csproj├── obj/└── bin/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:
- .NET 10 SDK — Provides the runtime and libraries
- VS Code — Your code editor
- C# Dev Kit — Intellisense, debugging, and project templates
- dotnet CLI — You'd use commands like:
dotnet new webapi -n StoreApi— create a new web API projectdotnet add package Dapper— add a database librarydotnet build— compile the codedotnet run— start the API server
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.
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:
dotnet rundotnetchecks if all dependencies are downloaded- If not, it runs
dotnet restoreautomatically - Downloads NuGet packages from the internet
- The C# compiler (
csc) compilesProgram.csto IL - Generates a
.dll(or.exe) file inbin/Debug/net10.0/ - Any referenced libraries are linked
- The CLR loads your compiled assembly
- Finds the entry point (
Mainmethod, auto‑generated in .NET 10) - JIT‑compiles the IL to native machine code
- Runs your code on the CPU
Console.WriteLinesends text to the terminal- You see Hello, World! on your screen
- The application exits with code
0(success)
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 — 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?
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:
- Learning C# and .NET — Lightweight, fast, and beginner‑friendly
- Web development — Building APIs, websites, and microservices with ASP.NET Core
- Console applications — Automation scripts, CLI tools, background services
- Cloud development — Deploying to Azure, AWS, or any cloud provider
- Cross‑platform development — Build once, run on Windows, macOS, and Linux
Consider a different setup for:
- Large enterprise solutions — Visual Studio Enterprise may be better for massive codebases
- Mobile development with MAUI — Visual Studio provides better tooling for mobile
- Game development with Unity — Unity has its own integrated tools
Mental Model
└── 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:
- SDK gives you the power to build and run
- VS Code gives you a comfortable place to write
- Extensions give you superpowers — IntelliSense, debugging, refactoring
- dotnet CLI is your command centre — create, build, run, test, publish
Key Takeaway
- Your development environment is your workshop — the tools you use to write, build, and run C# code.
- The .NET 10 SDK is the engine — it includes the compiler, runtime, libraries, and CLI tools.
- VS Code is a lightweight, cross‑platform editor that works perfectly with .NET.
- C# extensions add IntelliSense, debugging, project templates, and more.
- The dotnet CLI is your command centre:
dotnet new— Create a new projectdotnet build— Compile your codedotnet run— Build + executedotnet restore— Download dependenciesdotnet publish— Package for deployment
- Once set up, you're ready to build anything from a console app to a cloud‑scale web API.
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.