您如何将整个asp.net网站放入一个dll? [英] How do you put an entire asp.net website into one dll?

查看:179
本文介绍了您如何将整个asp.net网站放入一个dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C#为Asp.Net构建Web应用程序框架。该框架由dll文件,带代码隐藏文件的aspx文件,App_Code中的代码文件,css文件和图像组成。

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.

我看过 Web应用程序 Visual Studio 2008中的项目。这有助于删除所有代码文件,并将它们放入bin文件夹中的一个dll中。但是,所有其他文件仍然保留。

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.

我认为必须可以将这些文件放在资源文件中并将其包含到dll文件中。我看到有些控制提供者会这样做,例如Telerik。

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.

您如何做到这一点?并且有一些自动化的过程可以执行此操作,因为文件数超过1000。

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.

任何帮助都非常有用!

推荐答案

您实际上可以将站点简化为单个程序集,一个web.config文件和一个global.asax文件。

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

为此,请使用嵌入式资源将所有静态内容(图像等)嵌入到程序集中。这就是Telerik等组件供应商为控件提供单个程序集部署的目的。
然后可以使用虚拟路径提供程序来提供嵌入式资源。有一篇好文章可以介绍msdn上的虚拟路径提供程序。
使用Web应用程序项目时,您甚至可以将页面(.aspx)和用户控件(.ascx)嵌入为资源。

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.

使用路由模块可以将URL几乎透明地转换为程序集中嵌入的页面。

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

尽管有两个限制。


  • 默认情况下,IIS6不会提供程序集中的静态内容。使用自定义处理程序(例如files.ashx / my / static / content.jpg)或配置IIS以使用通配符映射将所有请求路由到您的应用程序。

  • 您将丢失一些将页面嵌入到程序集中时,Visual Studio中的设计器支持。

这篇关于您如何将整个asp.net网站放入一个dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆