Global code in vs2008

Discussion in 'ASP .Net' started by Greg Smith, Jul 11, 2008.

  1. Greg Smith

    Greg Smith Guest

    Has something changed in vc2008 ASP?



    When I add a class file and put namespaces in it they are not visible from
    other page code files. I imported an old vs2005 app into vs2008 and it
    still sees my code lib namespaces fine.



    I also notice that there is no "namespace" declared for the application as
    there was in vs2005.



    What is the best way to have a global code library with vs2008 ASP?





    Any help is greatly appreciated.
    Greg Smith, Jul 11, 2008
    #1
    1. Advertising

  2. Greg Smith

    Munna Guest

    Hi,

    You asked a very good question!... and you will here a lot of good
    suggestions,
    I think from the other gurus...

    Here why I do... If my project is small and the codes are current
    project specific
    I put them in a folder in the project... If the codes are a little bit
    general and can be
    identified as a component for example a mail management component... I
    put them
    in a separate project..

    Best of luck

    -----------
    Munna

    www.munna.shatkotha.com/blog
    www.munna.shatkotha.com
    www.shatkotha.com
    Munna, Jul 11, 2008
    #2
    1. Advertising

  3. You may not be using the same project. This sounds like you have created a
    Web Site Project. This behaves in the exact way you describe. Directories
    have their classes isolated from eachother because they are all compiled
    seperately (except all should be able to see the app_code directory). There
    is no default namespace, because the files aren't compiled into a single
    dll. What you want is a Web Application Project. You create this through the
    File | New Project | Web.

    Hope this helps,
    Mark Fitzpatrick
    Microsoft MVP - Expression

    "Greg Smith" <> wrote in message
    news:O4I$...
    > Has something changed in vc2008 ASP?
    >
    >
    >
    > When I add a class file and put namespaces in it they are not visible from
    > other page code files. I imported an old vs2005 app into vs2008 and it
    > still sees my code lib namespaces fine.
    >
    >
    >
    > I also notice that there is no "namespace" declared for the application as
    > there was in vs2005.
    >
    >
    >
    > What is the best way to have a global code library with vs2008 ASP?
    >
    >
    >
    >
    >
    > Any help is greatly appreciated.
    >
    >
    Mark Fitzpatrick, Jul 11, 2008
    #3
  4. I agree with Mark on this, as far as a way to solve the problem.

    On the other side, however, this is a very bad way to build an application
    (calling classes from other pages), as ASPX is a UI element and not a class
    library. You have absolutely no separation of concerns when you build things
    this way. You are better to move you code down into classes that are
    separate from your page's code behind files. You can then even take the step
    to move them to their own libraries, which is wise.

    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    Subscribe to my blog
    http://gregorybeamer.spaces.live.com/lists/feed.rss

    or just read it:
    http://gregorybeamer.spaces.live.com/

    ********************************************
    | Think outside the box! |
    ********************************************
    "Greg Smith" <> wrote in message
    news:O4I$...
    > Has something changed in vc2008 ASP?
    >
    >
    >
    > When I add a class file and put namespaces in it they are not visible from
    > other page code files. I imported an old vs2005 app into vs2008 and it
    > still sees my code lib namespaces fine.
    >
    >
    >
    > I also notice that there is no "namespace" declared for the application as
    > there was in vs2005.
    >
    >
    >
    > What is the best way to have a global code library with vs2008 ASP?
    >
    >
    >
    >
    >
    > Any help is greatly appreciated.
    >
    >
    Cowboy \(Gregory A. Beamer\), Jul 11, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hans Kesting

    vs2008 hangs when building solution

    Hans Kesting, Sep 24, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    620
    Teemu Keiski
    Sep 24, 2007
  2. shapper

    LINQ in VS2008

    shapper, Oct 15, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    348
    Patrice
    Oct 15, 2007
  3. ikari

    WebControl with VS2008

    ikari, Oct 26, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,314
    Teemu Keiski
    Nov 1, 2007
  4. =?Utf-8?B?cm9kY2hhcg==?=

    vs2008 deploy to localhost

    =?Utf-8?B?cm9kY2hhcg==?=, Nov 7, 2007, in forum: ASP .Net
    Replies:
    13
    Views:
    686
    Juan T. Llibre
    Nov 8, 2007
  5. Benjie Fallar III

    vs2008 code analysis vs. stylecop

    Benjie Fallar III, Jan 25, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    967
    Cowboy \(Gregory A Beamer\)
    Jan 26, 2009
Loading...

Share This Page