views:

1197

answers:

3

Hi all I've just started a new project using Visual Web Developer 2008 Express and all my code behinds are not in any namespace. How can I set the default namespace for the project?

In VisualStudioPro it used to be in project properties, the website properties in Visual Web Developer 2008 Express seem very ... express.

Thanks,

David.

A: 

Do Find and Replace to find your namespace and replace it with what you want.

The Alpha Nerd
I'm afraid this does not help, firstly there is no current namespace to match on, secondly I would want each new class I added to default to the same namespace. Thanks for the response, but does not help me.
David Waters
+1  A: 

If you are using the Website Project Template, then namespaces aren't used. If this is the case, consider using the Web Application Project Template.

IrishChieftain
+2  A: 

Visual Web Developer (prior to 2008 SP1) does not support Web Application projects. Default namespace is only available in Web Application projects.

If you really want to add your classes to a namespace, you should do it manually (the namespace surround with code snippet can prove pretty useful) by enclosing them in a namespace statement:

namespace MyDefaultNamespace {
   // original code
}
Mehrdad Afshari
@Mehrdad,Will the App_Code folder play nice with hand-rolled namespaces? If so, it's a good suggestion :-)
IrishChieftain
I don't think it has any specific problem with it. You can add <add namespace="MyDefaultNamespace" /> to Web.config file to make it behave as good.
Mehrdad Afshari
Thanks, for the answer not the one I was looking for, but made me feel less stupid knowing it is not possible to do by default. Guess that is why people pay for the real deal, not just the express.Thanks, David.
David Waters