C# Development Environment
A craftsman must sharpen his tools before doing a good job. Before we start writing C# code in earnest, we need to set up a development environment on our computer.
Setting up a C# development environment is not complicated — you only need to install two things:a runtime platform (.NET SDK)anda code editor, and you can begin your C# programming journey.
Step 1: Understand the relationship between .NET and C#
Before installing the tools, let's clarify a common question:Are C# and .NET the same thing?
No. Their relationship can be understood as follows:
- C# is the programming language you use to write code, like the "words" you use to write an article.
- .NET is the platform and toolset that runs the code, like the "printing press and paper" that allows words to be printed and spread.
A program you write in C# must rely on .NET to run on a computer. Therefore, the first step in setting up a C# development environment is to install the .NET SDK.
The current mainstream version of .NET is .NET 8(Long-Term Support version); it supports the three major platforms of Windows, macOS, and Linux, and is no longer limited to running only on Windows as in earlier years.

Step 2: Install the .NET SDK
The .NET SDK (Software Development Kit) contains the compiler, runtime, and various development tools; it is the foundation of C# development. The installation steps are as follows:
- Visit the official .NET download page:https://dotnet.microsoft.com/download
- Select the latest LTS (Long-Term Support) version, and beginners are recommended to choose the LTS version first, as it is stable and has abundant learning resources.
- Download the appropriate installer for your operating system (Windows / macOS / Linux) and follow the prompts to complete the installation.

After installation, open a command line (on Windows use "Command Prompt" or "PowerShell"; on macOS/Linux use "Terminal") and enter the following command to verify the installation:
dotnet --version
If a version number is output (such as 8.0.xxx), it means the .NET SDK has been installed correctly.
Step 3: Choose a code editor
With the .NET SDK, you can theoretically write code in Notepad and compile and run it from the command line. But in actual development, we all use specializedcode editors or IDEs (Integrated Development Environments), which provide features such as code completion, error hints, and debugging, greatly improving development efficiency.
For C# beginners, the following two tools are recommended:
① Visual Studio (recommended for Windows users)
Visual Studio is Microsoft's flagship IDE tailor-made for C#, with the most complete features and an excellent debugging experience; it is the most widely used C# development tool in enterprises today.
- Advantages: powerful, integrating code writing, debugging, testing, and publishing in one; especially suitable for developing Windows desktop applications and enterprise-level projects.
- Disadvantages: large installer (several GB), slow startup, and supports only Windows and macOS.
- Price: free for personal learning and study use Community (Community Edition) is free, with already very complete features.
- Download address:https://visualstudio.microsoft.com/zh-hans/downloads/

💡 During installation, on the "Workloads" page, check "ASP.NET and Web Development" or ".NET Desktop Development", and all components needed for C# will be installed automatically, with no separate configuration required.
② Visual Studio Code (recommended for cross-platform users)
VS Code is a lightweight code editor, small in size and fast to start, supporting Windows, macOS, and Linux. By installing the C# extension, you can also get a complete C# development experience.
- Advantages: lightweight and flexible, cross-platform, with a rich plugin ecosystem, suitable for developers who prefer a clean environment.
- Disadvantages: requires manual installation of plugins, and some advanced debugging features are not as complete as in Visual Studio.
- Price: completely free and open source.
- Download address:https://code.visualstudio.com/
💡 After installing VS Code, search the extension store for and install the C# Dev Kit plugin (officially released by Microsoft), and you will get complete features such as IntelliSense, debugging, and project management.
How to choose?
- If you use Windows, and your main goal is to learn C# basics or develop Windows applications → recommended: Visual Studio Community。
- If you use macOS or Linux, or you want a lighter editor → recommended: Visual Studio Code + C# Dev Kit。
More Related Tools
Step 4: Write your first C# program
Once the environment is set up, let's verify it — create and run the simplest C# project using the command line:
Open a command line and execute the following commands in order:
dotnet new console -n HelloWorld
cd HelloWorld
dotnet run
If you see the output:
Hello, World!
Congratulations! Your C# development environment has been set up successfully, and you have successfully run your first program.
Developing C# on macOS and Linux
As mentioned earlier, modern .NET (.NET 5 and above) natively supports cross-platform operation. macOS and Linux users can simply install the .NET SDK, and the experience is basically the same as on Windows.
In addition, you may also hear about something called Mono Mono. Mono was an early open-source cross-platform implementation of .NET launched by the community; it was once the main way to run C# on Linux and macOS. But with the full cross-platform support of Microsoft's official .NET, Mono's use cases have greatly diminished; today it is mainly used in specific scenarios such as the Unity game engine.For new projects, it is recommended to use the official .NET SDK directly; there is no need to install Mono.
To learn more about Mono, visit:http://www.mono-project.com/
