Groups | Blog | Home
all groups > visual studio .net general > april 2007 >

visual studio .net general : Create namespace when automatically generating classes of web pages/controls


Tokes
4/11/2007 5:28:43 PM
Hi there,

I'm using Visual Studio 2005 and I am working with a C# web project.
In this project I have a few directories to organise my pages and
controls.

When I create a new control in a sub directory (e.g. Controls), and
give it a name (e.g. MyUserControl), I find that in the generated .cs
file, the class name that has been assigned is
'Controls_MyUserControl', i.e. its full directory path, with
underscores instead of slashes. What I would have liked is if the
generated class was put inside a namespace (Controls), and that the
class name was just the name of the control (MyUserControl) - so that
its full name would be 'Controls.MyUserControl'.

Is there some way to tell Visual Studio to do this?

Thanks in advance,
- Tokes
marss
4/12/2007 12:29:17 AM

[quoted text, click to view]

If you are just starting a new project then install Service Pack 1 for
VS 2005, and use the Web Application project type instead of the Web
Site one.
Regards
AddThis Social Bookmark Button