Prevent Visual Studio from automatically including specific folders in generated C# namespaces.
Features
Automatically fixes namespaces when new C# files are added
Configurable excluded directory name
Enable/disable support through settings
Lightweight and focused
Works with Visual Studio's native extension system
Why?
By default, Visual Studio includes folder names when generating namespaces.
Creating a file at MyProject/src/Utils/ results in:
namespace MyProject.src.Utils
{
internal class MyClass { }
}
However, folders like src or Source usually should not be part of the namespace.
Exclude From Namespace automatically removes configured directory names from generated namespaces.
Before:
namespace MyProject.src.Utils
After:
namespace MyProject.Utils
Fully automatic. All you need is to choose the folder to exclude.