編譯器和語言提供者設定結構描述Compiler and Language Provider Settings Schema

編譯器和語言提供者設定會指定可用語言提供者的編譯器組態項目。Compiler and language provider settings specify compiler configuration elements for available language providers. 每個編譯器組態項目會指定程式碼提供者的類型名稱、編譯器參數、支援的語言名稱和副檔名。Each compiler configuration element specifies the code provider type name, compiler parameters, supported language names, and supported file extensions.

.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> <configuration>
   <system.object >   <system.codedom>
     <編譯器 >     <compilers>
       <編譯器 >       <compiler>

項目Element 描述Description
<system.codedom><system.codedom> 指定可用語言提供者的編譯器組態設定。Specifies compiler configuration settings for available language providers.
<compilers><compilers> 編譯器組態項目的容器;內含零或多個 <compiler> 項目。Container for compiler configuration elements; contains zero or more <compiler> elements.
<compiler><compiler> 指定語言提供者的編譯器組態屬性。Specifies the compiler configuration attributes for a language provider.

範例Example

下列範例說明典型的編譯器組態項目。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=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"  
          compilerOptions=""  
          warningLevel="1" />  
     </compilers>  
   </system.codedom>  
</configuration>  

另請參閱See also