Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C# Development Environment

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:

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:

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.

💡 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.

💡 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?

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/