Disadvantages in Visual Studio 2005 (Web sites)

Discussion in 'ASP .Net' started by m.roello, Jan 26, 2006.

  1. m.roello

    m.roello Guest

    In the book:
    "Working with Microsoft Visual Studio 2005"
    Craig Skibo wrote:
    "The power of Visual Studio 2005 lies in its ability to empower users to
    build, test, and debug powerful applications quickly and easly."

    I don't agree on what concernes ASP .NET Web Sites in VS2005.

    All what involves Namespaces in Web sites has been disappeared. I know
    you can still MANUALLY manage them, but not QUICKLY and EASLY. In a
    project I can subdivide the App_Code Folder in subfolders, but if I use
    the Powerfull "Class View" Window, I'm not very glad to see an infinity
    number of classes, all placed at the root of the project namespace.

    Grouping in namespaces is one of the most powerful skills tha .net gave
    us, since 1.0 and not only for .Net Windows Projects.

    Someone could reply me that the problem is pre-compilation. I know that
    now you can choose how to build your Web site, and this is very good.
    But the need of defining namespaces and grouping classes is indipendent
    from the way I'll decide to deploy the Web Site.

    Is this a "by design" issue?. Or it is a bug? In my opinion is a BIG
    black hole.

    I'm sorry for this lines, but I'm tired to search for workarounds for an
    IDE, abive all when a functionality was already present in the previous

    Marco Roello
    m.roello, Jan 26, 2006
    1. Advertisements

  2. m.roello

    Guest Guest

    Dear Disadvantaged,

    I don't often use the new class viewer, it is overpowering like you said.

    I'm am however using namespace inside the app_code folder.
    My Namespaces do come up in the IDE as expected type assist, imports, etc.
    Guest, Jan 26, 2006
    1. Advertisements

  3. m.roello

    Patrice Guest

    Not familier with VS.NET 2005 but can't you speciify the namespaces in your
    classes with the appropriate statement ?
    Patrice, Jan 26, 2006
  4. m.roello

    Guest Guest

    Thanks for your opinion,

    Maybe I've not explained very well the problem.
    I've already written that I know that I can MANUALLY define namespace, but
    the RAD tool doesn't help me in any mode....

    These are the real questions:

    In the App_Code directory, you can define custom namespaces for .cs files.
    But if you add a Dataset (.xsd) how can you define his namespace in visual

    A Web site isn't a collection of classes?

    Why a Windows Form Project or a ClassLibrary project manage namespaces in
    the right mode?

    Why in Visual Studio .Net 2003 I could do it and now not?

    Anyone know what does it mean to open hundred of aspx files and write the

    Guest, Jan 26, 2006
  5. m.roello

    Guest Guest

    Thanks Patrice,

    sorry but I'm talking about DISADVANTAGES of Visual Studio, not of the .Net
    Guest, Jan 26, 2006
  6. m.roello

    Scott Allen Guest

    I don't think it's a big issue. 99% of the types in code-behind /
    code-beside files are never used outside of the files they are defined
    in. Many times they end up in isolated assemblies.
    Scott Allen, Jan 26, 2006
  7. In actuality, if you are developing everything within the same website, then
    why do you need a namespace. If you use the App_Code directory for your
    website-specific classes and you have multiple ASPX pages (with or without
    code-behind), they are all compiled into the same assembly, so where's the
    need for a namespace.

    Note that I add my namespaces to my website files and I have no problem with
    it. It's not a major issue.
    Christopher Reed, Jan 27, 2006
  8. m.roello

    Guest Guest

    I'm sorry but I don't agree with you.

    All the .Net framework is a library subdivided in namespaces.

    I'm sorry if you say that you don't need namespaces, you say that .Net
    framework doesn't need them.
    Guest, Jan 27, 2006
  9. m.roello

    Guest Guest

    You are confusing the problem.

    Namespaces aren't assemblies.

    You can define the same namespace for different assemblies.

    NAMESPACES are LOGICAL rappresentation of your class library.

    And a Web site is an Application with one or more assemblies.

    Why the assemblies of a web site cannot be rappresented in namespaces?
    Guest, Jan 27, 2006
  10. m.roello

    Guest Guest

    A question to everyone tells me that they don't need namespaces:

    In your web site. You have 2 folders with 2 default.aspx files, one in each

    If build the web site, you'll get an error, because the compiler finds two
    classes with the same name.

    The solution is to define a different namespace for each aspx file (or one
    of them).

    Now, if I have to define ONE namespace for ONE class, a good developer
    SHOULD define namespaces for ALL the classes in the projects.

    I'll post the question in another thread.
    Guest, Jan 27, 2006
  11. m.roello

    Guest Guest

    answer me this question please:

    In the App_Code directory, you can define custom namespaces for .cs files.
    But if you add a Dataset (.xsd) how can you define his namespace in the web
    Guest, Jan 27, 2006
  12. m.roello

    Scott Allen Guest

    I never said they were.
    You aren't writing a class library, you are writing a web application.

    The ASP.NET runtime will be the only client for all those Page and
    UserControl derived types in your web application. The runtime doesn't
    need namespaces to figure out what type to use. This is unlike a
    developer. Namespaces present logical groupings for developers. I
    don't see how there is a BIG black hole when we don't have to write
    code like:

    using My.WebForms;

    Default_aspx form = new Default_aspx();
    Scott Allen, Jan 27, 2006
  13. m.roello

    Scott Allen Guest

    The framework does need namespaces. It would be a nightmare to find
    classes in a flat hierarchy.

    The difference is that the types in the framework have to be found by
    human developers. The types in a web application are used only by the

    There are exceptions of course, like the PreviousPage property for a
    cross page postback, but even then I think it's preferable to
    represent the other entity using an interface or a base class defined
    in a class library (or App_Code) that IS inside a logical namespace
    (so it can be found).

    Leave the Page and UserControl derived types as islands unto
    Scott Allen, Jan 27, 2006
  14. m.roello

    Scott Allen Guest

    Could you give us the exact error? Perhaps some code? It sounds like
    something else is wrong.
    Scott Allen, Jan 27, 2006
  15. m.roello

    Guest Guest

    Maybe I'm not explaining very well.

    - First of all, if you make a little search on the newsgroup or the web
    (keywords: dataset namespace) , you'll find a lot of post with the same

    - Second, You are forgotting that in VS2003, the IDE works in this manner:
    if you add a folder to a Web Project, and then an aspx file into it, if you
    take a look at the code behind, you will see that the class will have a
    namespace with this construct:

    namespace myprojectnamespace.myfolder

    - To reproduce the problem in VS2005, just add 2 folders to a web site, and
    then 2 web forms, each aspx in one folder, and name them default.apsx. You'll
    get an error.

    - Third do the same with 2 xsd files. In a web site add two folders in the
    App_Code. Call each xsd file DataSet1.xsd and put each xsd in a folder.

    When you say that you don't need namespaces, I get suprised.
    You should only answer this questions:

    1) How can you define the namespace of a xsd file in a Web site?
    2) Custom Namespaces are built automatically in ClassLibrary and
    WindowsForms projects. Why not in Web sites?
    3) Why in VS2003 the project namespaces were created automatically and now
    not? (compatibility)

    Guest, Jan 28, 2006
  16. m.roello

    Mark Rae Guest

    That simply isn't true.

    <%@ Page language="c#" CodeFile="default.aspx.cs"
    Inherits="home_default" %>
    public partial class home_default
    <%@ Page language="c#" CodeFile="default.aspx.cs"
    Inherits="welcome_default" %>
    public partial class welcome_default
    Why? Says who?
    Mark Rae, Jan 28, 2006
  17. m.roello

    Guest Guest

    we are talking about Visual Studio 2005. The RAD Tool.
    I know that you can manually define different namespaces.

    Please read again all the posts.
    Guest, Jan 28, 2006
  18. m.roello

    Scott Allen Guest

    Can you tell us what the specific error message is?

    You can't possibly have type name collisions unless there is something
    you aren't telling us. The default ASP.NET batch compilation will
    generate an assembly for each directory. The assemblies will both have
    names like App_Web_*.dll. Even then, the CodeFile classes should have
    names like Folder1_Default and Folder2_Default.

    Are you using aspnet_merge.exe, perhaps?
    Scott Allen, Jan 28, 2006
  19. m.roello

    Guest Guest

    That demonstrates that you ask me questions without trying.

    Just do what I described in VS2005, (1.5 minutes of work) and you'll get the
    I've also opened a Bug Reuest at Microsoft, and they have reproduced the

    Have you got VS2005?
    Guest, Jan 29, 2006
  20. m.roello

    Scott Allen Guest

    Yes, VS 2005 RTM.

    I have no problems putting two default.aspx web forms into two
    different directories. Please elaborate on the problem you see in this

    I do have a problem putting two .xsd files with the same name into two
    sub-directories of App_Code. You can put the generated DataSets into
    different namespaces by:

    1. Using a file naming convention.

    2. Use a class library instead of App_Code.

    As an example of #1, name one file Foo.DataSet1.xsd and the other
    Bar.DataSet1.xsd. The runtime will generate a DataSet1 class in a Foo
    namespace, and a DataSet1 class in a Bar namespace.
    Scott Allen, Jan 30, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.