views:

691

answers:

3

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

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

I think it must be possible to put these files in a resource file and include that into the dll file. I see that some control providers do that, like Telerik.

How do you go about doing that? And is there some automated process to do this as the number of files is more than 1000.

Any help is greatly appreaciated!

A: 

ASP.NET really doesn't have a "compile to a single DLL" approach (unfortunately - I had wished for it myself many times!).

As you noted, the Web Application helps reduce clutter somewhat.

Web Deployment also helps, in that the code of the web pages is compiled into a single DLL and you can actually remove the *.aspx/*.ascx files from your installation (if it's non-updateable), but you still have plenty of *.compiled files lying around.

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

Marc

marc_s
ok, too bad :(. I guess I have to make a custom handler and rewrite a lot of urls and build my own semi automated system. This will take some time.... thanks for answer
Ole Gulbrandsen
+1  A: 

You can actually reduce a site to a single assembly, a web.config file and a global.asax file.

To do this, embed all your static content (images etc.) in an assembly using embedded resources. This is what component vendors like Telerik do to provide single assembly deployments for their controls. The embedded resources can then be served up using a virtual path provider. There is a good article to get going with virtual path providers on msdn. Whn using a web application project, you can even embed pages (.aspx) and user controls (.ascx) as resources.

Using the routing module you can implement almost transparent translation of URL's to the pages embedded in the assembly.

There are a couple of limitations though.

  • IIS6 will not serve static content from your assembly by default. Either use a custom handler (e.g. files.ashx/my/static/content.jpg) or configure IIS to route all requests to your application using a wildcard mapping.
  • You will lose some of the designer support in Visual Studio when embedding pages in an assembly.
Marnix van Valen
Thank you, this will help me.
Ole Gulbrandsen
A: 

ASP.Net kind of has a "compile to a single DLL" with addons from Microsoft. Look at the "Web Deployment" add on. This will give you the ability to compile almost everything into a single DLL, including ASCX controls (which is a great way to redistribute those easily).