Getting web sites precompiled with Team Build

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.

Team Build and aspnet_compiler.exe


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.

more, including the solution...

tags: , ,

Comments (4)

  1. Hi Buck,

    In my blog I posted ( a tutorial on how to create a Team build that:

    1) Compiles your website

    2) Archives it into a zip file

    3) Deploys it to a staging server pre-compiled with one dll for each folder.

    If it serves anyone here, I´m glad to help.

  2. buckh says:

    Thanks, Bernardo!


  3. Jack says:

    Nice, very useful.

    Is there a method to deploy the auto built web app to web site directly?

  4. JimLamb says:

    Jack, you can use MSDeploy to package and/or deploy your web application. For an example of how to do this with TFS 2008, please see my blog post at:

Skip to main content