No Namespace Specified - Where Do the Types Live?

J

Johnson

I just converted an ASP.NET Web Site to be an ASP.NET Web Application
project type in Visual Studio 2005. After the conversion, the whole thing
still works - it builds and the Web app runs just fine. However, none of the
classes are placed explicitly in any namespace. The ASP.NET Web Site project
type apparentlyl infers namespace from the site's directory structure. But
Visual Studio's conversion process ("Convert to Web Application") does not
explicitly add any namespaces to any of the classes.

So, where do the classes live after the conversion? Is there some "default"
or "global" namespace into which the classes are placed? Just curious... I'm
not trying to solve any specific runtime problem here.

Thanks.
 
J

Juan T. Llibre

re:
!> So, where do the classes live after the conversion?

In the VS 2005 or 2008 IDEs, right-click your Project's name in the Solution Explorer,
select "Properties", then click on the Application menu on the left.

In 2008, you'll see a textbox for the "default namespace";
in 2005, the textbox is named "root namespace".

Set them to whatever you'd like the default/root namespace to be.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
I

Ignacio Machin ( .NET/ C# MVP )

I just converted an ASP.NET Web Site to be an ASP.NET Web Application
project type in Visual Studio 2005. After the conversion, the whole thing
still works - it builds and the Web app runs just fine. However, none of the
classes are placed explicitly in any namespace. The ASP.NET Web Site project
type apparentlyl infers namespace from the site's directory structure. But
Visual Studio's conversion process ("Convert to Web Application") does not
explicitly add any namespaces to any of the classes.

So, where do the classes live after the conversion? Is there some "default"
or "global" namespace into which the classes are placed? Just curious... I'm
not trying to solve any specific runtime problem here.

Thanks.

Hi,

They will live inside teh namespace defined by your project.
Do this test, add a new webform and see where it place it, most
probably you will see the class beind declared inside the namespace as
you expected
 
I

Ignacio Machin ( .NET/ C# MVP )

re:
!> So, where do the classes live after the conversion?

In the VS 2005 or 2008 IDEs, right-click your Project's name in the Solution Explorer,
select "Properties", then click on the Application menu on the left.

In 2008, you'll see a textbox for the "default namespace";
in 2005, the textbox is named "root namespace".

Set them to whatever you'd like the default/root namespace to be.

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
======================================

Hi Juan,

Nice seeing you around, been a while since we last talked to each
other.
Hope everything is ok with you.


cheers,
Ignacio.
 

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