24

If you precompile a web site and keep it updatable, the ASP.NET parser can see from the Page directive that there is no codefile or codebehind and where to find the base class (inherits attribute).

<%@ page language="C#" autoeventwireup="true" inherits="_Default, Precompiled"
  theme="Default" validaterequest="false" %>

If the site is precompiled and not updatable, the .compiled files in the bin folder should give the ASP.NET runtime all the necesary information on how to instantiate the page classes.

So why is the precompiledApp.config needed?

Thanks!

Liam
  • 27,717
  • 28
  • 128
  • 190
Michiel van Oosterhout
  • 22,839
  • 15
  • 90
  • 132

1 Answers1

17

It's used to indicate whether or not the ASPX/ASCX pages in your site are updateable or not. You can precompile and have the code behind compiled, but leave these pages updateable so you can make minor GUI-related tweaks should you wish.

Keith Adler
  • 20,880
  • 28
  • 119
  • 189
  • 1
    I understand the concept of precompiling and the updatable option. But why is the precompiledApp.config file needed? – Michiel van Oosterhout Sep 22 '09 at 06:49
  • 4
    Because ASP.NET by default will try to compile all files (including code-behinds) in the directory of an .ASPX page request along with App_Code and over files marked to be build if it doesn't find this file. If it finds a .precompiledApp.config file it will look into it and determine whether or not to still compile the ASPX files since they could be allowed to be updatable. – Keith Adler Sep 22 '09 at 16:33
  • 3
    Based on some experiments I believe that the file serves no purpose. You can precompile a site, allow it to be updatable and then replace one page with the original including its code file and both will be compiled. The precompiledApp.config does not determine wether or not pages are compiled, this seems to only be determined based on the page directive. It may differ when updatable is false, but I have not tested that. – Michiel van Oosterhout Mar 26 '10 at 15:13