A beginner-friendly environment for learning C# programming on Ubuntu! Perfect for:
- 🐧 Learning C# on Linux
- ✨ Writing clean, professional code
- 🧪 Learning test-driven development
- 🛠️ Building command-line applications
Think of this as your personal Ubuntu development environment that:
- 📦 Uses containers so everything works consistently
- 🔧 Comes with professional tools pre-configured
- 🧪 Includes testing tools from day one
- 📚 Has built-in documentation to help you learn
Before you begin, make sure you have:
- Ubuntu 22.04 LTS installed (recommended)
- Internet connection
- At least 4GB of free RAM
- 10GB of free disk space
Note: While Ubuntu 24.04 may work, we recommend using Ubuntu 22.04 LTS for the most stable experience.
This repository is set up as a template, which means:
- Don't clone it directly
- Click the green "Use this template" button on GitHub
- Choose "Create a new repository"
- This creates your own copy with a fresh Git history
- Go to https://github.com/MALATHON/csharp-devcontainer-template
- Click "Use this template" → "Create a new repository"
- Name your repository and create it
- Note down your new repository's URL - you'll need it later!
First, we need to install the required tools on your Ubuntu 22.04 system:
# Update your system first
sudo apt update && sudo apt upgrade -y
# Install required packages
sudo apt install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
# Install VS Code
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
sudo apt update
sudo apt install -y codeIMPORTANT: After running these commands, you must log out of Ubuntu completely and log back in for Docker permissions to take effect.
- Open VS Code
- Install the "Dev Containers" extension:
code --install-extension ms-vscode-remote.remote-containers
# Clone your new repository (replace with your repository URL from step 1)
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY-NAME.git
cd YOUR-REPOSITORY-NAME
# Open in VS Code
code .- When VS Code opens, click "Reopen in Container" when prompted
- Wait for setup (first time takes about 5-10 minutes)
- Watch the bottom right for progress
- The container is installing development tools
- Open Terminal in VS Code:
- Press Ctrl+` or
- Menu: View → Terminal
- Create your first project:
./scripts/create-project.sh
- 🛠️ Created a C# environment with:
- .NET 8.0 SDK
- Testing tools (xUnit, FluentAssertions, Moq)
- Code analysis tools
- 🔧 Configured a powerful terminal with:
- Oh My Zsh + Powerlevel10k theme
- Smart command completion
- Development shortcuts
- 📝 Set up VS Code with:
- C# language support
- Debugging tools
- Testing interface
- Start the documentation server:
mkdocs serve
- Open http://localhost:8000 in your browser
- Read these guides in order:
- 📘 "Getting Started → What is a Dev Container?"
- 🔰 "Getting Started → First Steps"
- 🧪 "Development → Testing"
This template includes GitHub Actions for CI/CD:
- ✅ Automatically builds your code
- ✅ Runs all tests
- ✅ Checks for common issues
- ✅ Works on every push and pull request
The workflow will:
- Set up .NET 8.0
- Create a new project
- Build the solution
- Run all tests
You can see the status of your builds in the "Actions" tab of your repository.
Note: These instructions are tested on Ubuntu 22.04 LTS.
# Add yourself to docker group
sudo usermod -aG docker $USER
# Log out and log back in# Check Docker service
systemctl status docker
# Start Docker if needed
sudo systemctl start docker
sudo systemctl enable docker- Check Docker resources:
Add:
# Edit daemon.json sudo nano /etc/docker/daemon.jsonThen:{ "default-memory": "4G", "default-cpus": "2" }sudo systemctl restart docker
- ✅ .NET 8.0 SDK
- ✅ Testing framework (xUnit)
- ✅ Code analysis tools
- ✅ Git integration
- ✅ Oh My Zsh with Powerlevel10k
- ✅ Smart command completion
- ✅ Development shortcuts
- ✅ Git integration
- ✅ C# language support
- ✅ Debugging tools
- ✅ Test Explorer
- ✅ Git tools
- ✅ Built-in docs server
- ✅ Code examples
- ✅ Testing guides
- ✅ Ubuntu-specific help
Remember: This environment is designed for learning C# on Ubuntu. While it might seem like a lot at first, we'll guide you through each part as you need it!
# Common commands you'll use:
dotnet run # Run your program
dotnet test # Run tests
dotnet build # Build your code
code . # Open current folder in VS Code
# Useful aliases (shortcuts):
d # dotnet
dr # dotnet run
dt # dotnet test
g # git
mk # mkdocs serve