How do you put an entire asp.net site in one dll?

I am creating a web application framework in C # for Asp.Net. The framework consists of a mix of dll files, aspx files with codebehind files, code files in App_Code, css files and images.

I looked at the Web Application project in Visual Studio 2008. This helps to remove all code files and put them in one dll in the bin folder. But all other files remain.

I think it should be possible to put these files in a resource file and include them in a DLL file. I see some control providers doing this like Telerik.

How do you do it? And is there some kind of automated process for this, since the number of files is over 1000.

Any help could be very receptive!

+1


a source to share


3 answers


In fact, you can narrow your site down to a single assembly, a web.config file, and a global.asax file.

To do this, insert all static content (images, etc.) into the assembly using inline resources. This is what component vendors like Telerik do to deploy a single assembly for their controls. The embedded resources can then be served using a virtual path provider. There is a good article to access virtual path providers in msdn. If you are using a web application project, you can even embed pages (.aspx) and custom controls (.ascx) as resources.

By using the routing module, you can implement almost transparent URL translation to pages inline in an assembly.



However, there are several limitations.

  • IIS6 will not load static content from your assembly by default. Either use your own handler (for example, files.ashx / my / static / content.jpg), or configure IIS to route all requests to your application using wildcard mapping.
  • You will lose some of the designer support in Visual Studio when you embed pages into an assembly.
+3


a source


ASP.NET doesn't really have a "compile one approach to DLL" (unfortunately - I've wanted it myself, many times!).

As you can see, the web app helps reduce clutter a bit.

Web Deploy also helps that the webpage code is compiled into a single DLL, and you can actually remove the files *.aspx/*.ascx

from your installation (if this is not updated), but you still have a lot of *.compiled

files lying around.



Unfortunately, I think at the moment there is no "out-of-the-box" solution for your requirement (and as far as I've heard so far, nothing like this is planned for VS2010 / ASP.NET 4.0 either).

Mark

+2


a source


ASP.Net is compiled into one DLL with additions from Microsoft. Take a look at "Web Deploy". This will give you the ability to compile pretty much everything into a single DLL, including ASCX controls (which is a great way to redistribute them).

+1


a source







All Articles