A Visual Studio Code extension to refactor using statements in your C# projects. Move all top-level using statements to a GlobalUsings.cs file for a simplified and modern C# project structure.
-
Right-click on
.csprojfile:
Recursively scans all.csfiles in the project folder (excludingbin,obj,.vs), moves all top-levelusingstatements toGlobalUsings.csin the project root, and removes them from the individual files. -
Right-click on
.slnor.slnx(solution) file:
Parses the solution file for all referenced.csprojprojects, applies the project-level logic to each project: allusingstatements are moved to their respectiveGlobalUsings.csfiles. -
Prevents duplicate
global usingstatements in the generatedGlobalUsings.cs. -
Available via context menu:
Easily access the command by right-clicking.csproj,.slnor.slnxfiles in the Explorer sidebar.
- Install the extension from the VS Code Marketplace.
- In the Explorer sidebar, right-click a
.csproj,.slnor.slnxfile. - Select "Move Usings to GlobalUsings.cs" from the context menu.
- The extension will refactor your code and display a notification when complete.
We welcome contributions!
- Fork the repository and clone it locally.
- Open the project in VS Code, and use the built-in debugger to run and test the extension.
- Create a pull request detailing your changes and improvements.
MIT License