compilation の compilers 要素 (ASP.NET 設定スキーマ)

[このドキュメントはプレビューのみを目的としており、以降のリリースで変更される可能性があります。プレースホルダーとして空白のトピックが含まれています。]

ASP.NET アプリケーションがサポートするコンパイラを指定します。

注意

.NET Framework Version 2.0 では、system.codeDom セクションの compilers 要素のために、この要素の使用を避けるように推奨されています。ただし、compilation 要素の compilers 子要素はまだ有効で、system.codedom セクションにある compilers 要素をオーバーライドします。

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

属性および要素

以降のセクションでは、属性、子要素、および親要素について説明します。

属性

なし。

子要素

サブタグ

Description

compiler

新しいコンパイラ オプションを定義します。

compiler セクションでは、任意の数の compiler タグを使用できます。

親要素

要素

Description

configuration

共通言語ランタイムおよび .NET Framework アプリケーションで使用されるすべての構成ファイルで必要なルート要素を指定します。

system.web

構成ファイルの ASP.NET 構成設定のルート要素を指定します。ASP.NET Web アプリケーションを構成する構成要素やアプリケーションの動作を制御する構成要素が含まれます。

compilation

ASP.NET でアプリケーションのコンパイルに使用されるすべてのコンパイル設定値を構成します。

解説

compilers 要素は、ASP.NET アプリケーションがサポートするコンパイラを指定します。

.NET Framework Version 2.0 では、system.codeDom セクションの compilers 要素のために、この要素の使用を避けるように推奨されています。 ただし、compilation 要素の compilers 子要素はまだ有効で、system.codedom セクションにある compilers 要素をオーバーライドします。

既定の構成

.NET Framework Version 2.0 では、compilers 要素の使用が推奨されていないため、既定では compilers 要素は構成されません。 ただし、system.codeDom セクションには、既定の compilers 要素が定義されています。 compilers 要素は、Machine.config ファイルまたはルート Web.config ファイルで明示的には構成されていません。 ただし、これはアプリケーションにより返される既定の構成です。

<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>

次の既定の compilers 要素は、.NET Framework Version 1.1 の Machine.config ファイルで構成されます。

<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>

次の既定の compilers 要素は、.NET Framework Version 1.0 の Machine.config ファイルで構成されます。

<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>

使用例

アプリケーションのコンパイル設定を構成する方法を次のコード例に示します。

<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>

    <assemblies>
       <add assembly="ADODB"/>
       <add assembly="*"/>
    </assemblies>

      </compilation>

要素情報

構成セクション ハンドラー

CompilationSection

構成メンバー

Compilers

CompilerCollection

構成できる場所

Machine.config

ルート レベルの Web.config

アプリケーション レベルの Web.config

仮想ディレクトリ レベルまたは物理ディレクトリ レベルの Web.config

要件

Microsoft Internet Information Services (IIS) バージョン 5.0、5.1、または 6.0

.NET Framework Version 1.0、1.1、または 2.0

Microsoft Visual Studio 2003 または Visual Studio 2005

参照

処理手順

How to: Configure Specific Folders Using Location Settings

How to: Lock ASP.NET Configuration Settings

Reference

system.web 要素 (ASP.NET 設定スキーマ)

compilation の assemblies 要素 (ASP.NET 設定スキーマ)

compilation の buildProviders 要素 (ASP.NET 設定スキーマ)

compilation の codeSubDirectories 要素 (ASP.NET 設定スキーマ)

compilation の compilers 要素 (ASP.NET 設定スキーマ)

コンパイルに使用する expressionBuilders 要素 (ASP.NET 設定スキーマ)

configuration 要素 (全般設定スキーマ)

System.Configuration

System.Web.Configuration

CompilationSection

Compilers

CompilerCollection

概念

ASP.NET Web Page Syntax Overview

ASP.NET Web Page Code Model

ASP.NET Configuration File Hierarchy

Securing Configuration

Configuration Inheritance

その他の技術情報

全般構成設定 (ASP.NET)

ASP.NET 構成設定

Configuring ASP.NET Applications

ASP.NET Configuration Files

ASP.NET Configuration API