Here’s how you install the .NET SDK on Ubuntu
Install .NET 8.0 on Ubuntu
-
Update Package Lists:
Ensure your package lists are updated:sudo apt update
-
Install .NET SDK using the Microsoft Package Repository:
Microsoft provides a package repository for .NET installations. Here’s how to set it up:
-
Install the HTTPS transport and the required GnuPG (GPG) key:
sudo apt install -y wget wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb
-
Install the .NET SDK:
sudo apt update sudo apt install -y dotnet-sdk-8.0
-
-
Verify Installation:
After installation, verify that .NET is installed correctly:
dotnet --version
This should show you the installed version of .NET, confirming that the .NET SDK is now set up.
Alternative: Use Snap
If you prefer using Snap, you can also install .NET via Snap. Note that Snap installs can be confined and behave slightly differently from apt installations. Here’s how to get it with Snap:
sudo snap install dotnet-sdk --classic
Choose the Appropriate Command
Since you’re working with .NET 8.0, ensure you’re installing the latest dotnet-sdk-8.0
or using Snap for version 8.0 specifically. After installing .NET using either of these methods, rerun your command:
dotnet ./MyApp.dll
This should successfully execute your application. Ensure that the dotnet
command is accessible in your current session; you might need to restart your terminal or re-source your profile if the command is still not found.