<compiler> Element

Defines a new compiler. Any number of <compiler> tags can be used in the <compilers> section.

<configuration>
   <system.web>
      <compilation>
         <compilers>
**            <compiler>**

<compiler language="language"
          extension="ext"
          type=".NET Type" 
          warningLevel="number"  
          compilerOptions="options"/>

Required Attributes

Attribute Description
language Provides a semicolon-separated list of languages used in dynamic compilation files. For example, "c#;cs;csharp".
extension Provides a semicolon-separated list of file name extensions used for dynamic code-behind files. For example, ".cs".
type Specifies a comma-separated class/assembly combination that indicates the .NET Framework class (which extends CodeDomProvider) that is used to compile all resources that use the specified language or file name extension.

Optional Attributes

Attribute Description
warningLevel Specifies compiler warning levels.
compilerOptions Lists additional compiler-specific options to pass during compilation.

Example

The following example configures compilation settings for an application.

<configuration>
   <system.web>
      <compilation defaultLanguage="VB"
         debug="true"
         numRecompilesBeforeAppRestart="15">
         <compilers>
            <compiler language="VB;VBScript"
               extension=".cls"
               type="Microsoft.VisualBasic.VBCodeProvider,system,     
                     Version=1.0.5000.0, Culture=neutral, 
                     PublicKeyToken=b77a5c561934e089"/>
            <compiler language="C#;Csharp"
               extension=".cs" 
               type="Microsoft.CSharp.CSharpCodeProvider,system, 
                     Version=1.0.5000.0,  Culture=neutral, 
                     PublicKeyToken=b77a5c561934e089"/>
         </compilers>
      </compilation>
   </system.web>
</configuration>

Requirements

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

<compilation> Element | <compilers> Element | ASP.NET Configuration | ASP.NET Settings Schema