<compilation> 元素

配置 ASP.NET 使用的所有编译设置。

配置结构的示例:

<configuration>
   <system.web>
      <compilation>

<compilation debug="true|false"
             batch="true|false"
             batchTimeout="number of seconds"
             defaultLanguage="language"
             explicit="true|false"
             maxBatchSize="maximim number of pages per 
                           batched compilation"
             maxBatchGeneratedFileSize="maximum combined size (in KB) 
                                        of the generated source file per
                                        batched compilation"
             numRecompilesBeforeAppRestart="number"
             strict="true|false"
             tempDirectory="directory under which the ASP.NET temporary 
                            files are created">
   <compilers>
      <compiler language="language"
                extension="ext"
                type=".NET Type"
                warningLevel="number"
                compilerOptions="options"/>
   </compilers>
   <assemblies>
      <add assembly="assembly"/>
      <remove assembly="assembly"/>
      <clear/>
   </assemblies>
</compilation>

可选的属性

属性 选项 描述
debug     指定是编译二进制发布文件还是编译二进制调试文件。默认值为 false。
    true 指定编译二进制调试文件。
    false 指定编译二进制发布文件。
defaultLanguage     指定在动态编译文件中使用的默认编程语言(例如“C#”或“PERL”)。使用 <compiler> 子标记来定义语言名称。默认设置为 vb。
explicit     表示 Microsoft Visual Basic explicit 编译选项的设置。默认值为 true。
    true 表示启用了 Visual Basic explicit 编译选项,并且必须使用 Dim、Private、Public 或 ReDim 语句来声明所有变量。
    false 表示禁用 Visual Basic explicit 编译选项。
batch     表示是否支持批处理。
    true 表示支持批处理。
    false 表示不支持批处理。
batchTimeout     表示用于批处理编译的超时周期(以秒为单位)。如果编译在超时周期内不能结束,则编译器将为当前页还原为单独编译模式。
maxBatchGeneratedFileSize     指定每个批处理编译所生成的源文件的最大大小(以 KB 为单位)。
maxBatchFileSize     指定每次批处理编译的页面的最大数量。
numRecompilesBeforeApprestart     表示在应用程序重新启动前,资源的动态重新编译可发生的次数。该属性在全局和应用程序级别受支持,但在目录级别不受支持。
strict     表示 Visual Basic strict 编译选项的设置。
    true 表示 Visual Basic strict 编译选项已启用。
    false 表示禁用 Visual Basic strict 编译选项。
tempDirectory     指定编译期间用于存储临时文件的目录。

子标记

子标记 描述
<compilers> 定义新的编译器选项。
<assemblies> 指定 ASP.NET 编译处理指令。

示例

下例为应用程序配置编译设置。

<configuration>
   <system.web>
      <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>
   </system.web>
</configuration>

要求



相关主题


© 1997-2003 Microsoft Corporation。保留所有权利。