csharp-como-instalar-dotnet

How to Install .NET

  • 3 min

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 C# applications.

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 downloads page
  2. Download the SDK: Download the appropriate installer for your system.
  3. Installation: Open the downloaded file and follow the instructions in the installation wizard.

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

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 your distribution. 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

Verification of the installation

Once installed, it doesn’t hurt to check that everything is configured correctly. The easiest 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, you need to download and install an IDE (Integrated Development Environment) to be able to write, debug, and run C# code.

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 one for working with C#. It offers many tools that make writing, debugging, and running code easier.

If you want to learn more, check out the Introduction to Programming Course

Install Visual Studio Code

If you prefer a lighter editor, Visual Studio Code is a good alternative. Although not as comprehensive as Visual Studio, it can work with C#.

To do this, it’s a good idea to install the appropriate extension.

  • Open Visual Studio Code.
  • Go to the Extensions tab (square icon on 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 C# applications using the .NET SDK.

If you want to learn more, check out the Introduction to Programming Course