views:

73

answers:

1

Is it possible to compile some code-behind (.cs) files (eg. all .cs file under a particular folder) into one DLL, and the rest into another DLL?

We have some common codes and pages (aspx + cs files) that we want to use across many websites. We want this to compile into a DLL (eg. Common.dll).

The rest of the files will be website-specific, unique to each website and should compile into another DLL (eg. Website3.dll)

This is so that if we make changes to a common code-behind, we can just publish Common.dll onto all our websites.

Is that possible using VS Web Developer Express 2008?

Thanks in advance.

EDIT: We are already using a class library, but not for pages (aspx+cs)

+2  A: 

Put simply, you need your common code in a separate project - a Class Library - and to then add a reference to that assembly to each of your web sites. You can either reference the assembly directly or you can (I think in Web Express) add the project to your solution and build the site and the common code together. I much prefer the latter but there are good arguments for both systems.

This is fairly fundamental to the way one builds .NET applications (-: You're going to need to understand namespaces and using/imports (depending on you language of choice).

Unfortunately I don't remember the mechanics of doing either with Express (if someone does could they edit or comment as appropriate).

As an aside, you'll need to think about how you integrate this into your version control system - details, to a certain extent, will depend on whether you reference a separately built .dll or include the project. If you don't have version control in place then stop, go sort that out first, and then come back and address this.

As a further aside, I think - though I'm happy to be corrected, that code-behind refers to code directly associated with a web form rather than to classes separate and distinct from those pages.

Murph
Thank you Murph. Sorry I forgot to mention we've already got a class library. But there are common pages (aspx+cs) as well, not just code. I don't think you can put those aspx pages and their code behinds in a class library?