Language: EN

csharp-como-instalar-dotnet

How to Install .NET

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 have separate instructions for each operating system and platform. But, in general,

  1. Go to the .NET download page
  2. Download the SDK: Download the installer appropriate for your system.
  3. Installation: Open the downloaded file and follow the installation wizard’s instructions.

And that’s it, it’s that easy. However, if you prefer to do it from the command line, here it is 👇

Installation from Console

Installation on Windows

You can install .NET from the command line using the package manager Choco.

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 running,

sudo apt update
sudo apt install -y dotnet-sdk-8.0

Verification of 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.

Install an IDE

Once the .NET framework is installed, it is necessary to download and install an IDE (Integrated Development Environment) 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.

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

Install Visual Studio Code

If you prefer a lighter editor, Visual Studio Code is a good alternative. Although it is not as complete 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.

vscode-csharp-extension

With Visual Studio Code and the C# extension, you will be able to run and debug applications in C# using the .NET SDK.