Visual Studio generated namespaces

C

Clive Dixon

VS 2005:

If I create a folder in my project, when I add new classes to that folder,
VS generates a namespace which is the project default namespace concatenated
with the folder name. Is it possible to turn this (immensely infuriating)
feature off so that it just uses the project default namespace regardless of
any folder structure?
 
M

Marc Gravell

I was hopeful that a custom template might do it; the content is
controlled by specific tokens in the template file (which you can
create yourself), but it looks like (contrary to the documentation),
$rootnamespace$ actually contains the folder info. One option would be
to use "namespace $projectname$" - if you can live with the namespace
being the same as the project name (which often they might be...).

You can find out about creating your own template here:

http://codebetter.com/blogs/david.hayden/archive/2005/11/06/134343.aspx

The available tokens are listed here:

http://msdn.microsoft.com/en-us/library/eehb4faa.aspx

(see also the 3.0 page - there is some mention there [in the user
content] of unlisted tokens).

Marc
 
T

Tim Jarvis

Clive said:
this (immensely infuriating) feature off so that it just uses the

I know this doesn't help you, but its nice to know I am not alone in my
annoyance at that "feature"


--
 
C

Clive Dixon

Thanks

Hoped there might be a quick way to do it, but I suspected that I would have
to go the roll my own route.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top