This repository contains a Dockerfile that provides a complete, "battery-included" development environment for C# (.NET 10) and Blazor, powered by Neovim (LazyVim).
It is designed to be a zero-config, portable solution: just build the container, and you have a full IDE experience ready to go.
dotnet-portable-dev-demo.mp4
- Base OS: Ubuntu 26.04.
- Editor: Neovim with the LazyVim preset (fast, beautiful, and Lua-based).
- Starship: Pre-configured for a minimal, blazing-fast, and customizable shell prompt.
- Eza: Included as a modern, colorful replacement for
lswith icons and Git integration. - Dev Tools: .NET SDK 10.0, ASP.NET runtime, and Entity Framework.
- Intellisense (LSP):
- C#:
roslyn.nvim(utilizing the official Microsoft Roslyn Language Server). - Razor:
rzls.nvim(full support for.razorfiles).
- C#:
- Debugging (DAP): Pre-configured
netcoredbgwith a user interface (nvim-dap-ui) for a full debugging experience. - Testing: Integrated unit testing via
neotest-dotnet. - Zero Config: Everything is "baked" into the image via the Dockerfile.
Follow these steps to build and run the environment locally from the source code.
git clone https://github.com/gbad8/dotnet-portable-developer-environment-dockerfile.git)](https://github.com/gbad8/dotnet-portable-developer-environment-dockerfile.git/cd dotnet-portable-developer-environment-dockerfileBuild the image tagging it as dotnet-pde (or any name you prefer).
Note: This might take a minute as it compiles Treesitter parsers and installs plugins.
docker build -t dotnet-pde .Run the command below to launch the container. This will mount your current directory inside the container, allowing you to edit files on your host machine while using the container's tools.
docker run -it \
--name csharp-env \
-v $(pwd):/home/portabledev/Work \
-P \
dotnet-pde-it: Ensures interactive mode (essential for running Neovim).-v $(pwd):/home/portabledev/Work: Maps your current local folder to the container's workspace. Any file you save inside is persisted to your local disk.-p: Exposes port 100 (designated in the Dockerfile) inside the container to a random port on your machine.
This project is optimized for Linux environments. If you are using Windows, you must run the commands via WSL 2 (Windows Subsystem for Linux).
- Open your distribution's terminal (e.g., Ubuntu) from the Start Menu or by typing
wslin PowerShell. - Navigate to your project's directory:
cd /mnt/c/Users/YourUser/Path/To/Project - Follow the build and execution instructions listed below.
- Note for 4GB RAM machines: You may experience input lag or system slowdowns due to intensive SWAP usage.
- Recommendation: To prevent freezing, close other heavy applications (such as browsers or GUI-based IDEs) before building the application or starting the Docker environment.
Once inside the container terminal, simply type nvim to open the editor.
| Shortcut | Description |
|---|---|
| Space + ff | Find Files |
| Space + fw | Live Grep (search text across all files) |
| Space + th | Open floating terminal |
| gd | Go to Definition |
| K | Show Documentation (Hover) |
The container comes with DAP fully configured. Use these keys to control execution:
| Key | Function |
|---|---|
| F5 | Start / Continue Debugging |
| F9 | Toggle Breakpoint |
| F10 | Step Over |
| F11 | Step Into |
| F8 | Step Out |
| Space + dr | Open Debug Console (REPL) |
This image was built specifically for .NET developers who want to avoid the complex manual configuration steps usually required for Roslyn and Neovim integration.
The Dockerfile uses a headless build process to:
- Install
roslynvia Mason during the build phase. - Compile Treesitter parsers for C# and Razor.
- Inject the necessary Lua configurations into the correct paths.
Requirements: You only need Docker installed. No local .NET or Neovim dependencies are required on your host machine.
The core development loop (Edit -> Run -> Debug) is fully functional. The current focus is on polish and tooling expansion:
- Implement Debugger:
netcoredbgis now fully integrated. - Implement Entity Framework.
- Implement Razor Support:
rzlsadded for Blazor development. - Terminal Aesthetics: Improve fonts, colors, and shell prompt.
- AI Assistance: Configure GitHub Copilot.
Contributions are welcome! If you find a bug or want to improve the Lua configs, feel free to open an issue or submit a Pull Request.
SOLI DEO GLORIA