<compiler> Element

Specifies the compiler configuration attributes for a language provider.

  type="typeName, assemblyName"
  compilerOptions="option1 option2"

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


Attribute Description


Optional attribute.

Specifies additional compiler-specific arguments for compilation.


Required attribute.

Provides a semicolon-separated list of file name extensions used by source files for the language provider. For example, ".cs".


Required attribute.

Provides a semicolon-separated list of language names supported by the language provider. For example, "c#;cs;csharp".


Required attribute.

Specifies the type name of the language provider, including the name of the assembly containing the provider implementation. The type name must meet the requirements defined in Specifying Fully Qualified Type Names.


Optional attribute.

Specifies the default compiler warning level; determines the level at which the language provider treats compilation warnings as errors.

Child Elements


Parent Elements

Element Description

<configuration> Element

The root element in every configuration file used by the common language runtime and .NET Framework applications.

<system.codedom> Element

Specifies compiler configuration settings for available language providers.

<compilers> Element

Container for compiler configuration elements; contains zero or more <compiler> elements.

Each <compiler> element specifies the compiler configuration attributes for a specific language provider. The provider extends the System.CodeDom.Compiler.CodeDomProvider class for a specific language; the <compiler> element defines the compiler and code generator settings for the language provider.

The .NET Framework defines the initial compiler settings in the machine configuration file (Machine.config). Developers and compiler vendors can add configuration settings for a new CodeDomProvider implementation. Use the System.CodeDom.Compiler.CodeDomProvider.GetAllCompilerInfo method to programmatically enumerate language provider and compiler configuration settings on a computer.

Compiler elements in the application or Web configuration file can supplement or override the settings in the machine configuration file. If more than one provider implementation is configured for the same language name or the same file extension, the last matching configuration overrides any previous configured providers for that language name or file extension.

This element can be used in the machine configuration file and the application configuration file.

The following example illustrates a typical compiler configuration element.

      <!-- zero or more compiler elements -->
        type="Microsoft.CSharp.CSharpCodeProvider, System, 
          Version=2.0.3600.0, Culture=neutral, 
        warningLevel="1" />

Community Additions