.NET: Split web application into multiple DLLs?
Is it possible to compile some code files (.cs) (for example, the entire .cs file in a specific folder) into one DLL and the rest into another DLL?
We have some generic codes and pages (aspx + cs files) that we want to use on many websites. We want this to compile into a DLL (like Common.dll).
The rest of the files will be specific to each site, unique to each site, and must be compiled into a different DLL (eg Website3.dll).
This is so that if we make changes to the common code, we can simply publish the Common.dll on all of our sites.
Is this possible with VS Web Developer Express 2008?
Thanks in advance.
EDIT: We are already using the class library but not for pages (aspx + cs)
a source to share
Simply put, you need your shared code in a separate project - Class Library - and then add a link to that assembly to each of your websites. You can either reference the assembly directly, or you can (in Web Express I think) add the project to your solution and put the site and shared code together. I prefer the latter, but there are good arguments for both systems.
This is pretty fundamental to how you build .NET applications (-: you need to understand namespaces and use / import (depending on the language you choose).
Unfortunately, I don't remember how the mechanics are done either with Express (if someone can edit or comment on them accordingly).
As an aside, you need to think about how you integrate this into your source control - the details will, to a certain extent, depend on whether you reference a separately built .dll or include a project. If you don't have version control in place, stop, first open it and then go back and point it out.
As another side, I think - although I'm happy to be fixed, this code-behind refers to the code directly related to the web form, and not to classes separate and different from these pages.
a source to share
Web Deploy Projects can be used here ( http://www.microsoft.com/download/en/details.aspx?id=25163 for VS2008 and http://www.microsoft.com/download/en/details.aspx? id = 24509 for VS2010). In the options, you can specify whether the output of your web project will be a separate dll (default for web applications) or an assembly for each folder.
This corresponds to having to change only one page / control and deploy only the assembly that is affected by the change.
But web deployment projects do not support VS Express versions.
a source to share