Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Auto NamespaceNew to Visual Studio Code? Get it now.
Auto Namespace

Auto Namespace

Auto Namespace

|
1 install
| (0) | Free
Automatically insert namespace declarations in C# files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Auto Namespace (VS Code)

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.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft