With a Web Application Project (WAP), you get a single assembly when you build your project. However with an ASP.NET Website, the output is spread among many dll files. The closest you will get is having all your classes in the AppCode folder in one assembly and the other classes in separate assemblies. Depending how many files you’ve got in your website, this can amount to a lot and I think having one single assembly is better for a number of reasons, the primary one being deployment onto a production server.
Instead of converting my ASP.NET website to a Web Application Project, I decided to use the aspnet_compiler.exe to build the website output and use aspnet_merge to merge the assemblies together. This means that everything for the website will be in one single assembly but note that other assemblies that you’re referring to will stay the same such as log4net, nhibernate etc.
You will need to go to Visual Studio Command Prompt to issue the following commands:
aspnet_compiler -v TestWeb -p “C:\Projects\TestWeb” “C:\Projects\TestWebCompiled”
aspnet_merge “C:\Projects\TestWebCompiled” -o Gis
This will first compile your website files and then merge the assemblies. You may encounter the following error when you use the aspnet_merge tool though:
aspnet_merge: error occurred: An error occurred when merging assemblies: ILMerge.Merge: ERROR!!: Duplicate type ‘FooterControl’ found in assembly ‘App_Web_xd23ggdz’.
In my case, it was because I had two web controls with the same name. I had to delete one of them but you can just rename yours and it should work fine afterwards.
There’s a great video at http://www.asp.net/general/videos/how-do-i-use-the-aspnet_mergeexe-utility-to-merge-assemblies showing you how to use the both the asp.net compiler and the asp.net merge tool.
The only thing I need to figure out now is how to remove certain files/folders from being compiled.