C# Install .NET SDK
To write and run C# programs, you need the .NET SDK (Software Development Kit), which includes the compiler, runtime, and command-line tools. It is free and available for Windows, macOS, and Linux.
Once installed, you can use the `dotnet` command-line tool to create, build, and run C# projects from any terminal, or use an IDE like Visual Studio or Visual Studio Code for a richer editing experience.
dotnet new console -o MyApp
cd MyApp
dotnet runInstalling the .NET SDK
Download the .NET SDK installer from dotnet.microsoft.com for your operating system. After installing, run `dotnet --version` in a terminal to confirm it works.
Editors and IDEs
Visual Studio (Windows) is a full-featured IDE for C#. Visual Studio Code with the C# extension is a lightweight, cross-platform alternative. JetBrains Rider is another popular choice.
dotnet --version8.0.100Checks that the .NET SDK is installed and shows its version.
dotnet new console -o HelloApp
cd HelloApp
dotnet runHello, World!Creates a new console project, then builds and runs it.
Key points
- The .NET SDK includes the compiler, runtime and CLI tools.
- The `dotnet` command is used to create, build, and run projects.
- Visual Studio, VS Code, and Rider all support C# development.
- .NET is free, open-source, and cross-platform.
