Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies the compiler configuration attributes for a language provider.
<configuration>
<system.codedom>
<compilers>
<compiler>
<compiler
language="languageName[;...;...]"
extension="fileExtension[;...;...]"
type="typeName, assemblyName"
warningLevel="number"
compilerOptions="option1 option2"
/>
The following sections describe attributes, child elements, and parent elements.
Attribute | Description |
---|---|
compilerOptions |
Optional attribute. Specifies additional compiler-specific arguments for compilation. The values for the compilerOptions attribute are typically listed in a compiler options topic for the compiler. |
extension |
Required attribute. Provides a semicolon-separated list of file name extensions used by source files for the language provider. For example, ".cs". |
language |
Required attribute. Provides a semicolon-separated list of language names supported by the language provider. For example, "c#;cs;csharp". |
type |
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. |
warningLevel |
Optional attribute. Specifies the default compiler warning level; determines the level at which the language provider treats compilation warnings as errors. |
Element | Description |
---|---|
<providerOption> Element | Specifies compiler version attributes for a language provider. |
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 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:
<configuration>
<system.codedom>
<compilers>
<!-- zero or more compiler elements -->
<compiler
language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System,
Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
compilerOptions="/optimize"
warningLevel="1" />
</compilers>
</system.codedom>
</configuration>
.NET feedback
.NET is an open source project. Select a link to provide feedback: