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.
Your development environment is the set of tools you use to write and run C# code. It includes:
.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:
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 .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.
Here's the complete setup we'll create:
dotnet new console to generate a template
dotnet run — see "Hello, World!" in the terminal
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).
VS Code is a free, lightweight code editor that works on all platforms. Download it from code.visualstudio.com.
Open VS Code, click the Extensions icon (left sidebar, looks like four squares), and search for:
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.
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!
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; — Every C# statement ends with a semicolonIn .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.
MyFirstApp/├── Program.cs├── MyFirstApp.csproj├── obj/└── bin/Imagine you're building a backend API for an online store. Your development environment would look like this:
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 serverThis same setup — one SDK, one editor, one set of tools — powers everything from tiny console utilities to massive enterprise systems serving millions of users.
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.
dotnet run Actually DoesWhen you type dotnet run in your terminal, a whole chain of events happens behind the scenes:
dotnet rundotnet checks if all dependencies are downloadeddotnet restore automaticallycsc) compiles Program.cs to IL.dll (or .exe) file in bin/Debug/net10.0/Main method, auto‑generated in .NET 10)Console.WriteLine sends text to the terminal0 (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.
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.
Wrong: Downloading ".NET Runtime" and wondering why dotnet new doesn't work
Correct: Download the .NET SDK — it includes everything you need
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
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
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.
Remember:
dotnet new — Create a new projectdotnet build — Compile your codedotnet run — Build + executedotnet restore — Download dependenciesdotnet publish — Package for deploymentYou'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?
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?
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?
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?
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?
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.