A Visual Studio Code extension for running, debugging, and exporting single C# files—no .csproj or solution required. Each open file gets its own isolated temp project with full .NET and NuGet support.
Features
Run & Debug Single C# Files
Instantly run or debug any standalone .cs file with no project setup required
Each open C# file gets its own isolated temp project/session
Breakpoints work as expected in the active editor
Run mode uses the standard VS Code terminal for real-time output and interactive input
Stop a running program at any time with Ctrl+C directly in the terminal
.NET Framework Selection
Choose from installed .NET SDKs/runtimes for each session
NuGet Package Management
Search NuGet.org live, add/remove packages per file session
View installed packages for the current file
Export as Project
Export the current session (code, csproj, packages) as a portable .NET project
Automatic Cleanup on Close/Shutdown
Temp projects are cleaned up when files are closed, or when you explicitly choose to clean up
On file close, if "Ask before closing file" is enabled, a context window appears with options: Yes (export first, then cleanup), No (cleanup now), or Cancel (reopen file, do not clean up)
On VS Code shutdown, the extension attempts to clean up all active temp projects before deactivation
The "Ask before closing file" preference can be toggled from the context menu; the menu item shows a checkmark when enabled
Multi-file Support
Open and manage multiple C# files independently; all commands operate on the focused file
Usage
Right-click a .cs file or use the Command Palette to access all features under the CSSingleRun submenu
When running a file, use the standard terminal to interact with your app (type input as prompted)
To cancel a running process, focus the terminal and press Ctrl+C
On close, default behavior is cleanup of the temp session folder for the current file
If Ask before closing file is enabled, the extension prompts whether to cleanup immediately, export first, or cancel (reopen file)
If you cancel, the prompt will appear again on the next close until a choice is made
On VS Code shutdown, the extension attempts cleanup for all active temp sessions
If shutdown cleanup is partially blocked, leftover temp folders are removed automatically on the next startup
Hotkeys (in C# files):
Ctrl+Alt+R — Run
Ctrl+Alt+D — Debug
Ctrl+Alt+F — Select Framework
Ctrl+Alt+N — Manage Packages
Ctrl+Alt+Shift+N — Remove Package
Ctrl+Alt+I — Show Session Info
Ctrl+Alt+E — Export as Project
Requirements
.NET SDK installed and available in PATH
For debugging: C# Dev Kit or C# extension (for CoreCLR debug support)
For more details, see the in-extension help or open an issue for support.
The extension automatically detects installed .NET frameworks. No additional configuration needed.