C# (.NET)
Installing C# and the .NET SDK on Ubuntu in TIDE
C# (.NET)
C# is a modern, object-oriented, and type-safe programming language developed by Microsoft. Powered by the open-source, cross-platform .NET runtime, C# is widely used for building web services, cloud-native microservices, desktop applications, mobile apps, and game development.
Installation
You can install the official Microsoft .NET SDK on Ubuntu directly via apt or using Microsoft's installation script.
Option 1: Using APT (Recommended)
Ubuntu repositories include native packages for the .NET SDK. Update your package index and install the LTS release:
apt update
apt install -y dotnet-sdk-8.0To install .NET 9 SDK:
apt update
apt install -y dotnet-sdk-9.0Option 2: Using the Official Install Script
If you prefer installing directly without system repository dependencies:
curl -sSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 8.0
export PATH=$PATH:$HOME/.dotnetTo make the environment variable persistent, add export PATH=$PATH:$HOME/.dotnet to your ~/.bashrc.
Verification
Confirm that the .NET CLI and SDK are installed and operational:
dotnet --version
dotnet --list-sdksWriting and Running Code
Using the .NET CLI
The standard workflow uses dotnet new to scaffold a console project:
dotnet new console -o HelloApp
cd HelloApp
dotnet runManual Project File and Source Code
Create a Program.cs file:
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World from C# in TIDE!");
}
}
}Build and execute the application with the .NET runner:
dotnet runTo produce an optimized release binary:
dotnet publish -c Release -o ./bin
./bin/HelloApp