Excellent question. Web Deployment Projects leverage two utilities aspnet_compiler.exe and aspnet_merge.exe.
aspnet_compiler.exe ships with the 2.0 Fx and pre-compiles an entire web site using the same compilation system as ASP.NET. Instead of just caching the pre-compiled bits into the ASP.NET temporary files folder it puts the files into re-deployable folder.
aspnet_merge.exe is a utility that ships with Web Deployment Projects. Because the aspnet_compiler.exe produces numerous assemblies, this utility offers various options to merge the aspnet_compiler generated assemblies into a smaller set of assemblies or even a single assembly.
So how does this relate to Web Application Projects?
Web Application Projects allows you to pre-compile the code behind and other classes with Visual Studio 2005 into a single assembly and supply this assembly as an input in the ASP.NET compilation process by putting it in the ~/bin folder.
When using WAP there are two stages to the compilation process. (This is the same as VS03). The first stage is to use VS to compile all the code behind and other classes into a single assembly and deploy it to the ~/bin folder. All the code in the .aspx, .ascx, .master, etc.. is always generated and compiled by ASP.NET, either dynamically during an http request or when using the aspnet_compiler.exe.
When ASP.NET is generating the code for each page, it’s looking at the “<%@ Page” directive and either seeing CodeFile="file" or CodeBehind="file". This is a key distinction. If it’s a CodeFile attribute ASP.NET knows it’s responsible for the compilation of the code behind code. This is what is used for Web Site projects included in VS05. If it’s a CodeBehind attribute ASP.NET knows the code behind has already been compiled and all it has to do is derive the page class from an already compiled code behind assembly. This is what is used in Web Application Projects and VS03.
Finally, I’m going to attempt to answer your question about Web Deployment Projects and assemblies per page. The ability to produce an assembly per page is a feature of the ASP.NET compilation system. When it is compiling pages it has the ability to batch pages together when generating an assembly or to generate an assembly per page. That is provided ASP.NET is doing the compilation. In the case of Web Application Projects the code behind for the pages have already been compiled into a single assembly. All ASP.NET has left to do is to generate the code for each page/control and generate the assemblies for those. If you’ve decided to make the deployable site updateable then the aspnet_compiler won’t even do that so the pages/controls can be edited and dynamically recompiled on the site. If it’s not updateable you can still get an assembly per page containing just the page class generated by ASP.NET and not the code behind since it’s already been compiled by VS.
I apologize for such as long winded reply but understanding what is being compiled when really helps understand the deployment options.
Hope this helps
Brad.