<system.object > 元素<system.codedom> Element

指定可用語言提供者的編譯器組態設定。Specifies compiler configuration settings for available language providers.

<configuration > 元素<configuration> Element
<system.object > 元素<system.codedom> Element

語法Syntax

<system.codedom>  
  <compilers> ... </compilers>  
</system.codedom>  

屬性和項目Attributes and Elements

下列各節描述屬性、子項目和父項目。The following sections describe attributes, child elements, and parent elements.

屬性Attributes

無。None.

子元素Child Elements

項目Element 描述Description
<compilers><compilers> 編譯器組態項目的容器;內含零或多個 <compiler> 項目。Container for compiler configuration elements; contains zero or more <compiler> elements.

父項目Parent Elements

項目Element 說明Description
<configuration><configuration> 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。The root element in every configuration file used by the common language runtime and .NET Framework applications.

備註Remarks

.NET Framework 版本2。0.NET Framework Version 2.0

System codedom > 專案包含電腦上所安裝之語言提供者的編譯器設定CSharpCodeProvider , 以及隨 .NET Framework 安裝的預設提供者, 例如和 < VBCodeProvider.The <system.codedom> element contains compiler configuration settings for language providers installed on a computer in addition to the default providers that are installed with the .NET Framework, such as the CSharpCodeProvider and the VBCodeProvider. 編譯器 > 元素包含零或多個 <編譯器 >元素。 < The <compilers> element contains zero or more <compiler> elements. 每個 <編譯器 >元素都會指定特定語言提供者的編譯器設定屬性。Each <compiler> element specifies the compiler configuration attributes for a specific language provider.

開發人員和編譯器廠商可以針對新CodeDomProvider的執行, 將設定值新增至電腦設定檔 (machine.config)。Developers and compiler vendors can add configuration settings to the machine configuration file (Machine.config) for a new CodeDomProvider implementation. CodeDomProvider.GetAllCompilerInfo使用方法, 以程式設計方式列舉電腦上的編譯器設定所識別的預設語言提供者和語言提供者。Use the CodeDomProvider.GetAllCompilerInfo method to programmatically enumerate both the default language providers and language providers identified by the compiler configuration settings on a computer.

注意

在 .NET Framework 版本1.0 和1.1 中, .NET Framework 所提供的預設語言提供者會在 <編譯器 >元素中識別出來。In the .NET Framework versions 1.0 and 1.1, the default language providers supplied by the .NET Framework are identified in the <compilers> element. 在 .NET Framework 版本2.0 中, <編譯器 >元素中不會識別預設語言提供者, 但可以使用GetAllCompilerInfo方法來列舉。In the .NET Framework version 2.0, the default language providers are not identified in the <compilers> element, but can be enumerated using the GetAllCompilerInfo method.

.NET Framework 版本1.0 和1。1.NET Framework Versions 1.0 and 1.1

System.web > 元素包含電腦上語言提供者的編譯器設定。 < The <system.codedom> element contains the compiler configuration settings for language providers on a computer. 編譯器 > 元素包含零或多個 <編譯器 >元素。 < The <compilers> element contains zero or more <compiler> elements. 每個 <編譯器 >元素都會指定特定語言提供者的編譯器設定屬性。Each <compiler> element specifies the compiler configuration attributes for a specific language provider.

.NET Framework 會在電腦組態檔 (Machine.config) 中定義初始編譯器設定。The .NET Framework defines the initial compiler settings in the machine configuration file (Machine.config). 開發人員和編譯器廠商可以為新的 CodeDomProvider 實作新增組態設定。Developers and compiler vendors can add configuration settings for a new CodeDomProvider implementation. 使用 CodeDomProvider.GetAllCompilerInfo 方法,以程式設計方式列舉電腦上的語言提供者和編譯器組態設定。Use the CodeDomProvider.GetAllCompilerInfo method to programmatically enumerate language provider and compiler configuration settings on a computer.

組態檔Configuration File

此元素可以在電腦設定檔和應用程式佈建檔中使用。This element can be used in the machine configuration file and the application configuration file.

範例Example

下列範例說明典型的編譯器設定。The following example illustrates a typical compiler configuration.

<configuration>  
  <system.codedom>  
    <compilers>  
      <!-- zero or more compiler elements -->  
      <compiler   
        language="c#;cs;csharp"  
        extension=".cs"  
        type="Microsoft.CSharp.CSharpCodeProvider, System,   
          Version=1.0.5000.0, Culture=neutral,   
          PublicKeyToken=b77a5c561934e089"  
        compilerOptions=""  
        warningLevel="1" />  
    </compilers>  
  </system.codedom>  
</configuration>  

另請參閱See also