Export (0) Print
Expand All

compiler Element for compilers for compilation (ASP.NET Settings Schema) 

Defines a new compiler option. Any number of compiler tags can be used in the compiler section.

NoteNote

In the .NET Framework version 2.0, this element is deprecated in favor of the compiler element of the system.codeDom section. However, using the compilers child element of the compilation element is still valid and overrides the compilers element that is located in the system.codedom section.


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

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

compilerOptions

Optional attribute.

Lists additional compiler-specific options to pass during compilation.

extension

Optional attribute.

Provides a semicolon-separated list of file name extensions that are used for dynamic code-behind files. For example, ".cs".

language

Optional attribute.

Provides a semicolon-separated list of languages that are used in dynamic compilation files. For example, "c#;cs;csharp".

type

Required attribute.

Specifies a comma-separated class/assembly combination that indicates the .NET Framework class (which extends the CodeDomProvider class) that is used to compile all resources that use the specified language or file name extension.

warningLevel

Optional attribute.

Specifies compiler warning levels.

Child Elements

None.

Parent Elements

Element Description

configuration

Specifies the required root element in every configuration file that is used by the common language runtime and the .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration settings in a configuration file and contains configuration elements that configure ASP.NET Web applications and control how the applications behave.

compilation

Configures all compilation settings that ASP.NET uses to compile applications.

compilers

Specifies the compilers that the ASP.NET application supports.

NoteNote

In the .NET Framework version 2.0, this element is deprecated in favor of the compilers element of the system.codeDom section. However, using the compilers child element of the compilation element is still valid and overrides the compilers element that is located in the system.codedom section.

The compiler element defines a new compiler option. You can use any number of compiler tags in the compiler section.

In the .NET Framework version 2.0, this element is deprecated in favor of the compiler element of the system.codeDom section. However, using the compilers child element of the compilation element is still valid and overrides the compilers element that is located in the system.codedom section.

By default, the compilers element is not configured in the .NET Framework version 2.0 because the compilers element has been deprecated. However, there is a default compilers element that is defined in the system.codeDom section.

This element is not explicitly configured in the Machine.config file or in the root Web.config file. However, it is the default configuration that is returned by application.

<system.codedom>
   <compilers>
       <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=%ASSEMBLY_VERSION%, Culture=neutral, PublicKeyToken=%ECMA_PUBLICKEY%" warningLevel="1" />
       <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=%ASSEMBLY_VERSION%, Culture=neutral, PublicKeyToken=%ECMA_PUBLICKEY%" />
       <compiler language="js;jscript;javascript" extension=".js" type="Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=8.0.1100.0, Culture=neutral, PublicKeyToken=%MICROSOFT_PUBLICKEY%" />
       <compiler language="vj#;vjs;vjsharp" extension=".jsl" type="Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=%ASSEMBLY_VERSION%, Culture=neutral, PublicKeyToken=%MICROSOFT_PUBLICKEY%" />
       <compiler language="c++;mc;cpp" extension=".h" type="Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=8.0.0.0, Culture=neutral, PublicKeyToken=%MICROSOFT_PUBLICKEY%" />
   </compilers>
</system.codedom>

The following default compilers element is configured in the Machine.config file for the .NET Framework version 1.1.

<compilers>
   <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="1"/>
   <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
   <compiler language="js;jscript;javascript" extension=".js" type="Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
   <compiler language="VJ#;VJS;VJSharp" extension=".jsl" type="Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</compilers>

The following default compilers element is configured in the Machine.config file for the .NET Framework version 1.0.

<compilers>
    <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="1" />
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <compiler language="js;jscript;javascript" extension=".js" type="Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</compilers>

The following code example demonstrates how to configure 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>

Configuration section handler

CompilationSection

Configuration member

Compilers

Compiler

Configurable locations

Machine.config

Root-level Web.config

Application-level Web.config

Virtual or physical directory–level Web.config

Requirements

Microsoft Internet Information Services (IIS) version 5.0, 5.1, or 6.0

The .NET Framework version 1.0, 1.1, or 2.0

Microsoft Visual Studio 2003 or Visual Studio 2005

Community Additions

ADD
Show:
© 2014 Microsoft