The first step to start developing in C# in the .NET environment is to download and install .NET (what an obvious statement I just made).
The .NET SDK (Software Development Kit) is the set of tools needed to compile and run applications in C#.
The latest available version can be downloaded from the official Microsoft website https://dotnet.microsoft.com/download.
On the page, you will find separate instructions for each operating system and platform. But, in general,
- Access the .NET downloads page
- Download the SDK: Download the installer appropriate for your system.
- Installation: Open the downloaded file and follow the instructions of the installation wizard.
And that’s it, that easy. However, if you prefer to do it from the command line, here it is 👇
Installation from the command line
Installation on Windows
You can install .NET from the command line using the Choco package manager.
choco install dotnet-sdk
Installation on Linux
This depends on the distribution you have. For example, for versions with APT (Ubuntu or similar), you can install it from a terminal by doing,
sudo apt update
sudo apt install -y dotnet-sdk-8.0
Verifying the installation
Once installed, it’s a good idea to check that everything is correctly configured. To do this, the simplest way is to open a terminal or command prompt and type:
dotnet --version
If you see a version number, like 8.0.100
, your installation was successful.
Installing an IDE
Once the .NET framework is installed, it is necessary to download and install an IDE (Integrated Development Environment) to be able to write, debug, and run code in C#.
Microsoft Visual Studio is the recommended IDE, but it is also possible to use others like Visual Studio Code
Installing Visual Studio
Visual Studio is a very comprehensive integrated development environment (IDE) and the most recommended for working with C#. It offers many tools that facilitate writing, debugging, and executing code.
More information about what it is and how to install Visual Studio
in the Introduction to Programming Course read more
Installing Visual Studio Code
If you prefer a lighter editor, Visual Studio Code is a good alternative. Although it is not as comprehensive as Visual Studio, it can work with C#.
To do this, it is advisable to install the appropriate extension.
- Open Visual Studio Code.
- Go to the Extensions tab (square icon in the sidebar) and search for “C#“.
- Install the official Microsoft extension to get IntelliSense and debugging support.
With Visual Studio Code and the C# extension, you will be able to run and debug C# applications using the .NET SDK.
More information about what it is and how to install Visual Studio Code
in the Introduction to Programming Course read more