.NET Introduction
What .NET is, the CLR, JIT and BCL, plus the difference between .NET Framework, .NET Core and modern .NET.
What is .NET?
.NET is Microsoft's free, open-source, cross-platform platform for building applications — web APIs, desktop apps, mobile apps, cloud services, games, and more. ".NET" isn't a single thing; it's three parts working together:
- The runtime (CLR) — the Common Language Runtime executes compiled code, manages memory (garbage collection), handles exceptions, and enforces type safety. Similar in spirit to the JVM in the Java world.
- The Base Class Library (BCL) — a huge standard library shipped with .NET: collections, LINQ, file I/O, networking, JSON, threading, and more, available to every .NET app without installing anything extra.
- The SDK — the command-line tools (
dotnet), compilers, and project templates you use day to day to create, build, run, test, and publish applications.
Multiple languages compile down to the same intermediate representation and run on the same CLR: C# (by far the most common), F# (functional-first), and VB.NET. This tutorial track focuses on C#, since it's what almost all real-world .NET code is written in.
// Program.cs — a complete, runnable .NET program
Console.WriteLine("Hello, .NET!");
dotnet run
# Hello, .NET!
A brief history: .NET Framework → .NET Core → modern .NET
| Era | What it was | Status |
|---|---|---|
| .NET Framework (2002–2019, up to 4.8) | Windows-only, tightly coupled to the OS, shipped with Windows itself | Legacy — maintained for compatibility, no new features |
| .NET Core (2016–2020, up to 3.1) | A rewrite: cross-platform (Windows/macOS/Linux), open-source, faster, side-by-side installable | Superseded by "modern .NET" |
| .NET 5+ (2020–present) | Microsoft dropped "Core" from the name and unified everything into a single, yearly-released platform | This is what ".NET" means today |
The renaming matters: .NET 5, 6, 7, 8, 9... are the direct successor to .NET Core, not to .NET Framework. .NET Framework 4.8 was the final release of the old Windows-only branch and will not get a 4.9. Every even-numbered release (.NET 6, 8, 10...) is a Long-Term Support (LTS) release, supported for three years — .NET 8 is the current LTS as of this writing and the version used throughout this tutorial track.
If you see old blog posts or Stack Overflow answers mentioning web.config, System.Web, or targeting net48, that's .NET Framework — different (older, Windows-only) from everything covered here.
Installing the .NET SDK
Download the SDK (not just the runtime — the SDK includes the runtime plus the CLI tools and compilers) from dotnet.microsoft.com:
- Windows — run the installer, or
winget install Microsoft.DotNet.SDK.8. - macOS — the
.pkginstaller, orbrew install --cask dotnet-sdk. - Linux — your distro's package manager (e.g.
sudo apt install dotnet-sdk-8.0on recent Ubuntu) or Microsoft's package feed.
Verify it installed correctly:
dotnet --version
# 8.0.401
dotnet --list-sdks
# 8.0.401 [C:\Program Files\dotnet\sdk]
Your first program
Create a new console project with the CLI — no IDE required:
dotnet new console -o HelloDotnet
cd HelloDotnet
This scaffolds a small project:
HelloDotnet/
├── HelloDotnet.csproj # project file: target framework, package references
├── Program.cs # your code
└── obj/, bin/ # build output (safe to delete, regenerated)
Program.cs uses modern top-level statements (available since C# 9) — no class Program or static void Main boilerplate required for a simple program:
Console.WriteLine("Hello, World!");
Under the hood the compiler still generates a real Main method — top-level statements are purely a syntax convenience for the entry-point file.
Running it
dotnet run
# Hello, World!
dotnet run compiles the project (if anything changed) and executes it in one step — ideal for development. For a standalone build you'd deploy, use dotnet build (compiles only) or dotnet publish (produces a self-contained, deployable output).
What happens when you run it
.NET code doesn't compile straight to machine code. The C# compiler (csc, invoked for you by dotnet build) compiles your source into Intermediate Language (IL) — a CPU-independent bytecode — packaged into a .dll. When you run it, the CLR's JIT (Just-In-Time) compiler translates that IL into native machine code for the CPU you're actually running on, method by method, the first time each is called.
This is what makes .NET genuinely cross-platform: the same compiled .dll runs unchanged on Windows, macOS, or Linux, as long as a .NET runtime is installed there — the JIT handles producing the right native code for that specific machine.
Common mistakes
- Installing only the runtime instead of the SDK, then being unable to run
dotnet newordotnet build— the SDK is what you want for development. - Confusing .NET Framework with .NET — they share a name lineage but are different platforms; new projects should always target modern .NET (8, or the current LTS), never .NET Framework.
- Expecting
dotnet runto produce a distributable artifact — it's a dev convenience; usedotnet publishfor anything you intend to deploy.
Interview questions
Q: What's the difference between the .NET SDK and the .NET runtime?
The runtime is only what's needed to execute an already-built .NET application (the CLR plus the BCL). The SDK includes the runtime plus the compilers and CLI tooling (dotnet new, dotnet build, dotnet publish) needed to develop one. Production servers often only need the (smaller) runtime installed; developer machines need the SDK.
Q: What language runs on .NET besides C#? F# (a functional-first language) and VB.NET both compile to the same IL and run on the same CLR as C#. In practice, the overwhelming majority of production .NET code is C#.