How to NOT include Visual Studio Project folder names in generated namespaces

sbohlen picture sbohlen · Feb 2, 2009 · Viewed 11.5k times · Source

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.

Answer

bdukes picture bdukes · Feb 2, 2009

If you have ReSharper installed, on the settings for the directory (F4), set Namespace Provider to false.