VS Code Extensions
A

Auto Namespace

by mhdg-factory

Automatically insert namespace declarations in C# files

Downloads

31

Rating

— (0)

Version

1.0.0

Last updated

May 19, 2026

Minimal extension that inserts or updates a C# file-scoped namespace derived from the file's path relative to the workspace.

Usage

  • Open this workspace in VS Code.
  • Press F5 (Run Extension) to launch an Extension Development Host, or install the extension manually.
  • Open a C# file and run the command: Auto Namespace: Insert/Update Namespace for C# file from the Command Palette (Ctrl+Shift+P).

Behavior

  • If the file is inside the workspace, the namespace is the relative directory path with / replaced by . (e.g. AllFinance.Api/Handlers -> AllFinance.Api.Handlers).
  • If the file is in the workspace root, the workspace folder name is used as namespace.

Related extensions