Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reference classes of a website project

15 views
Skip to first unread message

Tem

unread,
Feb 6, 2008, 4:21:01 PM2/6/08
to
My solution has 2 website projects. I need to reference a class in Website
A's app_code folder in Website B. but I can't figure out what namespace to
use.
Can this be done?

Tem

Nicholas Paldino [.NET/C# MVP]

unread,
Feb 6, 2008, 4:31:40 PM2/6/08
to
Tem,

You can't do this. Rather, you need to create a library project and
place the class in there, then add the reference to the output in each
website.


--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Tem" <tem...@yahoo.com> wrote in message
news:%23gjszYQ...@TK2MSFTNGP05.phx.gbl...

sloan

unread,
Feb 6, 2008, 4:31:26 PM2/6/08
to

You need to push the common code ...DOWN into a common assembly.

This is sometimes called a business layer....or comparable.

And then have both websites reference the same dll.

........

A website should be considered a presentation layer....and almost anything
you can push down a level will help you in the end.

You're fortunate in that with 2 presentation layers...you actually can
visualize the WHY you should push it down a little better than those who use
a single layer, with a single presentation layer.


Here is a sample of a layered application.

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!139.entry


"Tem" <tem...@yahoo.com> wrote in message
news:%23gjszYQ...@TK2MSFTNGP05.phx.gbl...

Tem

unread,
Feb 6, 2008, 4:40:43 PM2/6/08
to
then what is the point of the app_code folder?

"sloan" <sl...@ipass.net> wrote in message
news:eLKOldQa...@TK2MSFTNGP04.phx.gbl...

Tem

unread,
Feb 6, 2008, 4:43:02 PM2/6/08
to
is there a way to change the default reference of a new code page?


so that new code files I create in my project will have my references

Have

using System;
using MyProject.MyClass;

for every new file


"Nicholas Paldino [.NET/C# MVP]" <m...@spam.guard.caspershouse.com> wrote in
message news:#jDR5bQa...@TK2MSFTNGP03.phx.gbl...

Nicholas Paldino [.NET/C# MVP]

unread,
Feb 6, 2008, 5:01:41 PM2/6/08
to
Tem,

Well, you could create a new item template (if you google, you should be
able to find examples), but remember, you also have to set the reference in
your project, just adding the using statement isn't enough.


--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Tem" <tem...@yahoo.com> wrote in message

news:%23B9nHlQ...@TK2MSFTNGP03.phx.gbl...

sloan

unread,
Feb 6, 2008, 4:58:20 PM2/6/08
to

You can have compiled code which is SPECIFIC to the presentation layer.

That's a reason for App_Code.

Usually....presentation specific code...but common among pages is a good
candidate here.

Google
N Layered Development

..

App_Code is ok for hobby'ist websites that don't need code reuse/sharing.

But not for anything beyond that.


"Tem" <tem...@yahoo.com> wrote in message

news:eUFT0jQa...@TK2MSFTNGP05.phx.gbl...

Tem

unread,
Feb 6, 2008, 7:08:19 PM2/6/08
to
Can I use the same project (Class library) with multiple solutions? is this
allowed in .net or VS?

"sloan" <sl...@ipass.net> wrote in message

news:#N6YnsQa...@TK2MSFTNGP03.phx.gbl...

sloan

unread,
Feb 6, 2008, 7:21:03 PM2/6/08
to

Yes.

You should plan out your directory structure a little bit, and then make
this happen.

That's the point. Push code down into reusable components.

..

During development, your (multiple) solutions...can reference the "common"
project.
As in, "Add Existing Project". This will allow you to actually step thru
the debugger.

During deployment, or when you think the "common" assembly is really
good....you can build it...and then reference from the other projects...via
a hard file.


I would STRONGLY recommend this book:
http://www.amazon.com/Developing-Application-Frameworks-NET-Chen/dp/1590592883/

Not so much for the code samples (its 1.1 code) but for the lessons you'll
learn about reusing code.

Check ebay , because sometimes you can get a book like this for really
cheap.

"Tem" <tem...@yahoo.com> wrote in message

news:usEOT2Ra...@TK2MSFTNGP04.phx.gbl...

Tem

unread,
Feb 6, 2008, 10:36:24 PM2/6/08
to
do you know where I can find some good examples of this?

"sloan" <sl...@ipass.net> wrote in message

news:OYpkW8Ra...@TK2MSFTNGP04.phx.gbl...

sloan

unread,
Feb 7, 2008, 11:48:12 AM2/7/08
to

Here is the setup I (my company) uses:

(compiled code..dll's only)
\DotNet\v20\Assemblies\Applications\
\DotNet\v20\Assemblies\Framework\ (nothing in here, just a holder for
release and beta folders)
\DotNet\v20\Assemblies\Framework\Release\
\DotNet\v20\Assemblies\Framework\Beta\

( SOURCE CODE)
\DotNet\v20\Source\Applications\
\DotNet\v20\Source\Framework\
\DotNet\v20\Source\ThirdParty\

Examples:

(SOURCE CODE examples)

\DotNet\v20\Source\Applications\NorthwindManager\
(This is an application...one of many probably)
(but all the source code for the NorthwindManager goes here)


\DotNet\v20\Source\Framework\MyCompany.DataAccessHelper\
(This is a framework piece...the source code).
(Notice I can reference it via other applications via a RELATIVE path if
need be)


\DotNet\v20\Source\ThirdParty\Wintellect\PowerCollections\
(This is where I put source code for projects I get from the web or
something)


(COMPILED CODE examples)

\DotNet\v20\Assemblies\Applications\NorthwindManager.dll

\DotNet\v20\Assemblies\Framework\Release\MyCompany.DataAccessHelper.dll

\DotNet\v20\Assemblies\Framework\Release\PowerCollections.dll


"Tem" <tem...@yahoo.com> wrote in message

news:uNYglqTa...@TK2MSFTNGP03.phx.gbl...

Tem

unread,
Feb 7, 2008, 10:25:56 PM2/7/08
to
Thanks

"sloan" <sl...@ipass.net> wrote in message

news:Or3d9jaa...@TK2MSFTNGP04.phx.gbl...

0 new messages