Reputation: 2019
How do I prevent the name of the Solution Folder in a VS project from being appended to the namespace generated for new items added to the solution folder?
Example: C# project in a VS solution Default Namespace set in C# project properties: "BigClient.Domain"
If you create a solution folder in this project called "MySpecialStuff" and then add a new class to the 'MySpecialStuff" solution folder, VS creates the new .cs file with a "BigClient.Domain.MySpecialStuff" namespace. I want to find a way to allow the namespace of the newly-added class to retain just the 'project-level' namespace of "BigClient.Domain" instead of VS appending the "MySpecialStuff" solution-folder-name to the namespace.
I seem to recall reading a blog post by someone that this was possible (either via options/settings in VS or a registry setting) but I cannot recall where or how now that I want it :)
My platform is VS 2008 if answer = different for different VS versions.
Upvotes: 42
Views: 13070
Reputation:
Make a new class template or change Visual Studio's class template. See the MSDN documentation for how to this. In the template file, you quickly see the line that inserts the 'safe' namespace name.
Upvotes: 1
Reputation: 156005
If you have ReSharper installed, on the settings for the directory (F4), set Namespace Provider to false.
Upvotes: 7