Aaron Hallberg wrote a great post explaining how to build precompiled web sites with Team Build. The problem is that building them does not, by default, produce precompiled websites where all of the code is in dlls and removed from the ASP.NET source files.
Because Team Build typically compiles solutions and not projects, an additional complication is introduced with website projects. By default, these projects have the -u option selected for their compilation in their solution property pages.
With this option turned on, aspnet_compiler.exe keeps markup, including inline code, in all *.aspx and *.ashx files (and possibly others – I’m no expert in these matters) so that they can be modified after the site is deployed. So – if you compile your website projects by using MSBuild to compile the solutions that contain them:
> msbuild.exe C:MyProjectsWebApplication.sln
…your *.aspx and *.ashx files will be updatable and will not be compiled. Since Team Build typically compiles solutions, builds done through Team Build will run into the same issue.