Choose a supported release
Check the official .NET support policy and the installation page for your operating system before downloading. Choose a supported Long Term Support (LTS) SDK for a new learning project unless an existing project specifies another supported target. Use the newest patch for that release line. Do not treat a preview build or an end-of-support version as the default beginner choice.
At the 21 October 2026 review, .NET 10 is the supported LTS line recommended here; .NET 8 and 9 are also listed as supported but approach their November 2026 end-of-support dates. The example package name dotnet-sdk-10.0 in the Linux guide is tied to this review date. Recheck the support policy and your distribution’s package page before installing later. The SDK version you install, the target framework chosen by a project, and the runtime required to launch its output are related but not identical choices.
SDK or runtime: which do you need?
Install the .NET SDK if you want to write, build or run your own C# projects. It supplies the dotnet CLI, project templates and build tools, and includes a corresponding runtime. A runtime-only installation can execute a compatible framework-dependent app, but it does not supply the tools needed for dotnet new or dotnet build.
For a deployed app, the required runtime depends on how that app was published. A console app can use the .NET Runtime; an ASP.NET Core app needs the ASP.NET Core Runtime, which includes the base .NET Runtime. A self-contained deployment bundles what it needs instead of relying on a separately installed shared runtime. For these learning guides, select the SDK download or SDK package, not a runtime-only option.
Install the SDK on Windows
Open Microsoft’s .NET download page and choose the supported SDK release you selected above. In the SDK section, choose the Windows installer for your CPU architecture (typically x64 or Arm64); do not choose a runtime-only installer. Check your device’s processor type in Windows Settings if you are unsure. Run the official installer, follow its prompts and open a NEW PowerShell window afterward so it can see any updated PATH.
The Windows installation page also documents WinGet and other methods. An installer is the simplest starting point for one SDK. Use the official Windows install page for supported OS versions and architecture details rather than following an old third-party setup video.
- Choose a supported release on the official .NET download page.
- Select its Windows SDK installer for your device architecture, run it and finish the prompts.
- Close and reopen PowerShell, then verify the SDK before creating a project.
Visual Studio is optional
Visual Studio is a Windows IDE that can install the .NET tooling through selected workloads. Download the current Visual Studio installer from Microsoft if you want its integrated editor, project templates and debugger. Select the .NET desktop development workload for Windows desktop projects or ASP.NET and web development for web projects; choose only the workloads you need. Check Microsoft’s SDK-to-Visual-Studio compatibility table for the release you selected.
Visual Studio is not required for a console program: the SDK and PowerShell are enough. Visual Studio editions have different licence terms, so choose an edition your use permits.
Verify from PowerShell
Open a new PowerShell window and run the commands below. dotnet --list-sdks should display at least one SDK version; dotnet --list-runtimes lists installed shared runtimes. dotnet --info adds architecture and installation details. A runtime entry without an SDK entry means you can run some apps but cannot build this guide’s project.
where.exe dotnet shows which dotnet executable PowerShell finds. If several installations exist, the first one on PATH may not be the one you expected.
PowerShell — inspect the installation
dotnet --list-sdks
dotnet --list-runtimes
dotnet --info
where.exe dotnetCommon Windows setup problems
If dotnet is not recognised, reopen PowerShell and check where.exe dotnet. Confirm that the SDK installer completed and that your Windows version is supported. On an Arm-based PC, check that the selected SDK architecture and the dotnet path match the environment you intend to use.
If dotnet --list-sdks is empty, you probably installed only a runtime; install the SDK. If Visual Studio cannot target the SDK you installed, check the official Visual Studio compatibility table and update the IDE or use the matching supported SDK. If dotnet run says it cannot find a project, enter the folder containing HelloCSharp.csproj before retrying.
Create and run a first project
After verifying the SDK, open a terminal in a folder where you can create files. The first command creates a new console project with Program.cs and a project file. Change into that folder, replace Program.cs with the example below, save it, then run the project. dotnet run builds the project if needed and prints the output in the terminal.
The example is a small top-level C# program, supported by modern .NET console templates. Console.WriteLine writes one line of text. If your editor still shows the template’s Hello, World! output, confirm that you saved the correct Program.cs before running again.
Terminal — create and enter a console project
dotnet new console -n HelloCSharp
cd HelloCSharpTerminal — after replacing and saving Program.cs
dotnet runSyntax
dotnet --list-sdksExamples
Program.cs: a first console program
Replace the generated Program.cs with this line, then run dotnet run in the project folder. Expected output: Hello from C#!
Console.WriteLine("Hello from C#!");- The quoted characters form a string containing the message. The quotes are part of C# syntax and are not printed.
- Console is a .NET library class. Its WriteLine method writes the string to standard output and then starts a new line; the terminal displays that output.
- The semicolon ends the statement. Save Program.cs, run dotnet run from the folder containing the project file, and change the message to check that your edits take effect.
Best practices
- Choose a currently supported SDK from the official .NET site or the supported package source for your operating system.
- Check dotnet --list-sdks before creating a project; a runtime-only installation is not enough to build C# source.
- Keep your practice project in its own writable folder and run dotnet run from the folder containing its project file.
- Follow your organisation’s approved installation process on a managed computer.
Runtime & versions
.NET runtime. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
C# language reference