No Namespace Specified - Where Do the Types Live?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johnson

    #1

    No Namespace Specified - Where Do the Types Live?

    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.


  • Juan T. Llibre

    #2
    Re: No Namespace Specified - Where Do the Types Live?

    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/
    =============== =============== ========
    "Johnson" <A@B.comwrote in message news:upuaHxMSJH A.4576@TK2MSFTN GP03.phx.gbl...
    >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.
    >

    Comment

    • Ignacio Machin ( .NET/ C# MVP )

      #3
      Re: No Namespace Specified - Where Do the Types Live?

      On Nov 17, 10:50 am, "Johnson" <A...@B.comwrot e:
      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

      Comment

      • Ignacio Machin ( .NET/ C# MVP )

        #4
        Re: No Namespace Specified - Where Do the Types Live?

        On Nov 17, 11:24 am, "Juan T. Llibre" <nomailrepl...@ nowhere.com>
        wrote:
        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.

        Comment

        Working...