Eliminating the folder name from the added item's namespace

In Visual Studio when you add a folder to a solution, and then add an item into that folder the namespace on the generated item includes the folder name.

For example, if I have a project named Project1 with a folder named Folder1 and I right click on Folder1 to add a new class... the namespace created in that file is generated as:

namespace Project1.Folder1 {}

While I want to organize my code files inside my project... I really don't want the folder hierarchy to build a namespace hierarchy. I assume for some people they do this, or want to do this. But not I.

However, I want to control the namespace. Time to cowboy up and customize my Visual Studio templates. So I took a look at the item template for Class. It includes the following:

namespace $rootnamespace$ { class $safeitemrootname$ { } }

A Visual Studio template uses tokens which are surrounded by $'s which are called template parameters. The built in parameters are listed http://msdn.microsoft.com/en-us/library/eehb4faa%28VS.80%29.aspx. Apparently the doc is not quite correct because in my C# project the root name space in the properties was "Project1" however Visual Studio is populating it including the folder name.

I investigated the console application Project template and it included the following for the program.cs file and it used:

namespace $safeprojectname$ { class Program { static void Main(string[] args) { } } }

Eureka... I thought I had the answer. I changed the class item template to use $safeprojectname$ rather than $rootnamespace$ but alas $safeprojectname$ appears to be only populated when you use "Add Project" rather than "Add item".

Sorry dear readers to disappoint you. I know I am disappointed. I will continue to use my work around of creating the item in the root of the project and then moving it into the folder.

If someone knows a way to resolve this, I would love to hear it.