How to Install C# on Any GNU/Linux Distro
CSharp is a strongly typed, multiparadigm programming language developed by Microsoft as part of the .NET platform.
C# is a strong-type, multiparadigm programming language developed by Microsoft as part of the .NET platform.
Its syntax is object-oriented and was based on C++, but it includes many influences from other programming languages, such as Object Pascal and, mainly, Java, the latter being its biggest competitor.
In this article we will see how to install on any Distribution GNU/Linux .
01. Download the Bash installation script
With wget
wget https://dot.net/v1/dotnet-install.sh
or with cURL
curl -LO https://dot.net/v1/dotnet-install.sh
02. Give execute permission with sudo
or root
sudo chmod +x ./dotnet-install.sh
03. Run the script to install the latest version
./dotnet-install.sh --version latest
04. Enable CSharp for all users
Although it’s optional, it’s good to make the command global, this will be good for many circumstances!
sudo mv ./.dotnet/ /opt/dotnet
05. Enter the binary path to your $PATH
and for CSharp to find the root document
Run the three commands below in order:
echo -e '\nexport DOTNET_ROOT=/opt/dotnet' | sudo tee -a /etc/profile
echo 'export PATH=$PATH:/opt/dotnet:/opt/dotnet/tools' | sudo tee -a /etc/profile
source /etc/profile
06. Test the dotnet
command
dotnet --version
dotnet --help
07. Create a test Hello, World!, and run it!
Create a new project
dotnet new console -o HelloWorld
Enter the project, compile and run:
cd HelloWorld
dotnet build
dotnet run
Useful links
- https://terminalroot.com/how-to-install-csharp-on-ubuntu-and-getting-started/
- https://github.com/terroo/langs-test-loop/blob/main/round2/main.cs
- https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual
- https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
- https://docs.microsoft.com/pt-br/dotnet/csharp/tour-of-csharp/tutorials/
- https://dotnet.microsoft.com/en-us/learn/dotnet/hello-world-tutorial/intro
- https://docs.microsoft.com/pt-br/dotnet/csharp/
Comments