Global code in vs2008

G

Greg Smith

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.
 
M

Munna

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
 
M

Mark Fitzpatrick

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
 
C

Cowboy \(Gregory A. Beamer\)

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! |
********************************************
 

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