Share via

<compilation> Element

Configures all the compilation settings that ASP.NET uses.


<compilation debug="true|false" 
             batchTimeout="number of seconds"
             maxBatchSize="maximim number of pages per 
                           batched compilation"
             maxBatchGeneratedFileSize="maximum combined size (in KB) 
                                        of the generated source file per
                                        batched compilation"
             tempDirectory="directory under which the ASP.NET temporary 
                            files are created">
      <compiler language="language"
                type=".NET Type" 

      <add assembly="assembly"/>
      <remove assembly="assembly"/>

Optional Attributes

Attribute Option Description
debug     Specifies whether to compile retail binaries or debug binaries. The default is false.
    true Specifies compilation of debug binaries.
    false Specifies compilation of retail binaries.
defaultLanguage     Specifies the default programming language, such as "C#" or "PERL", to use in dynamic compilation files. Language names are defined using the <compiler> subtag. The default is vb.
explicit     Indicates the setting of the Microsoft Visual Basic explicit compile option. The default is true.
    true Indicates that the Visual Basic explicit compile option is enabled and that all variables must be declared using a Dim, Private, Public, or ReDim statement.
    false Indicates that the Visual Basic explicit compile option is disabled.
batch     Indicates whether batching is supported.
    true Indicates that batching is supported.
    false Indicates that batching is not supported.
batchTimeout     Indicates the time-out period, in seconds, for batch compilation. If compilation cannot be completed within the time-out period, the compiler reverts to single compilation mode for the current page.
maxBatchGeneratedFileSize     Specifies the maximum size (in KB) of the generated source files per batched compilation.
maxBatchFileSize     Specifies the maximum number of pages per batched compilation.
numRecompilesBeforeApprestart     Indicates the number of dynamic recompiles of resources that can occur before the application restarts. This attribute is supported at the global and application level but not at the directory level.
strict     Indicates the setting of the Visual Basic strict compile option.
    true Indicates that the Visual Basic strict compile option is enabled.
    false Indicates that the Visual Basic strict compile option is disabled.
tempDirectory     Specifies the directory to use for temporary file storage during compilation.


Subtag Description
<compilers> Defines a new compiler option.
<assemblies> Specifies ASP.NET compilation processing directives.


The following example configures compilation settings for an application.

      <compilation defaultLanguage="VB"
            <compiler language="VB;VBScript"
                     Version=1.0.5000.0, Culture=neutral, 
            <compiler language="C#;Csharp"
                     Version=1.0.5000.0,  Culture=neutral, 

            <add assembly="ADODB"/>
            <add assembly="*"/>


Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.Configuration.CompilationConfigHandler

See Also

ASP.NET Configuration | ASP.NET Settings Schema