如何使用VS 2010将ASP.NET 4.0预编译为单个DLL [英] How to precompile ASP.NET 4.0 to a Single DLL with VS 2010
问题描述
我最近从我在ASP.NET 2.0网站上工作的VS 2003升级到了我已迁移到ASP.NET 4.0的VS 2010.到目前为止,让我的网站使用新版本进行编译一直是一个很大的麻烦.一个问题是我的aspx.cs页面在我的项目中找不到共享的代码库.我通过将共享代码移至App_Code文件夹解决了此问题(如果有其他更好的方法,请告诉我).
I recently upgraded from VS 2003 where I was working on a ASP.NET 2.0 website to VS 2010 where I have migrated to ASP.NET 4.0. So far it has been a big headache to get my site compiling with the new version. One problem was that my aspx.cs pages could not find the shared code libraries in my project. I solved this by moving my shared code to the App_Code folder (if there's a different/better way to do it please let me know).
我发现另一个令人困惑的问题是预编译.使用VS 2003,我可以单击构建项目"按钮,它将我的网站预编译为myweb.dll和myweb.pdb文件.现在,在VS 2010中执行相同操作时遇到了麻烦.在VS 2010中构建站点时,未创建dll.我确实找到了一个发布"该站点的选项,该过程要花很多时间(例如2分钟),并且涉及将站点复制到另一个文件夹.这将是可以接受的,但是与其制作单个DLL文件,不如制作一堆文件:App_code.compiled,app_code.dll,App_code.pdb,App_global.asax.compiled,App_global.asax.dll,App_global.asax.pdb ,App_Web_lrpcway1.dll,App_Web_lrpcway1.compiled,App_Web_lrpcway1.pdb.
Another issue that I am finding confusing is with pre-compilation. With VS 2003 I could click the build project button and it would precompile my site into a myweb.dll and myweb.pdb files. Now I'm having trouble doing the same in VS 2010. When I build the site in VS 2010 the dll is not created. I did manage to find an option to "Publish" the site which takes forever (like 2 minutes) and involves duplicating the site to another folder. This would have been acceptable but instead of making the single DLL file, it makes a bunch of files: App_code.compiled, app_code.dll, App_code.pdb, App_global.asax.compiled, App_global.asax.dll, App_global.asax.pdb, App_Web_lrpcway1.dll, App_Web_lrpcway1.compiled, App_Web_lrpcway1.pdb.
该应用程序正常工作-我可以将所有这些文件部署到该应用程序中.但是,我真的很希望有人能解释什么是多余的文件,以及是否有更好的方法来实现它.
The application works - I can deploy it with all these files. However, I'd really like someone to explain what are the extra files and if there is a better way how to do it.
谢谢
推荐答案
您可以使用ASP.NET合并工具将所有小DLL组合成一个大DLL.
You can use the ASP.NET Merge Tool to combine all of the little DLLs into one big one.
http://msdn.microsoft.com/en-us/library/bb397866.aspx
这篇关于如何使用VS 2010将ASP.NET 4.0预编译为单个DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!