<useLegacyJit> 元素<useLegacyJit> Element

确定公共语言运行时是否使用实时编译的旧版 64 位 JIT 编译器。Determines whether the common language runtime uses the legacy 64-bit JIT compiler for just-in-time compilation.

<configuration>
  <runtime>
    <useLegacyJit>

语法Syntax

<useLegacyJit enabled=0|1 />

元素名称 useLegacyJit 区分大小写。The element name useLegacyJit is case-sensitive.

特性和元素Attributes and elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

属性Attribute 说明Description
enabled 必需的特性。Required attribute.

指定运行时是否使用旧版64位 JIT 编译器。Specifies whether the runtime uses the legacy 64-bit JIT compiler.

enabled 属性enabled attribute

Value 说明Description
00 公共语言运行时使用 .NET Framework 4.6 及更高版本中包含的新64位 JIT 编译器。The common language runtime uses the new 64-bit JIT compiler included in the .NET Framework 4.6 and later versions.
11 公共语言运行时使用较旧的64位 JIT 编译器。The common language runtime uses the older 64-bit JIT compiler.

子元素Child elements

None

父元素Parent elements

元素Element 描述Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关运行时初始化选项的信息。Contains information about runtime initialization options.

注解Remarks

从 .NET Framework 4.6 开始,默认情况下,公共语言运行时为实时(JIT)编译使用新的64位编译器。Starting with the .NET Framework 4.6, the common language runtime uses a new 64-bit compiler for Just-In-Time (JIT) compilation by default. 在某些情况下,这可能会导致应用程序代码的行为与以前版本的64位 JIT 编译器进行 JIT 编译的行为不同。In some cases, this may result in a difference in behavior from application code that was JIT-compiled by the previous version of the 64-bit JIT compiler. 通过将 enabled 元素的属性设置 <useLegacyJit>1 ,可以禁用新的64位 jit 编译器,而使用旧的64位 jit 编译器编译应用程序。By setting the enabled attribute of the <useLegacyJit> element to 1, you can disable the new 64-bit JIT compiler and instead compile your app using the legacy 64-bit JIT compiler.

备注

<useLegacyJit>元素仅影响64位 JIT 编译。The <useLegacyJit> element affects 64-bit JIT compilation only. 与32位 JIT 编译器的编译不受影响。Compilation with the 32-bit JIT compiler is unaffected.

您可以通过两种其他方法启用旧版64位 JIT 编译器,而不是使用配置文件设置:Instead of using a configuration file setting, you can enable the legacy 64-bit JIT compiler in two other ways:

  • 设置环境变量Setting an environment variable

    COMPLUS_useLegacyJit 环境变量设置为 0 (使用新的64位 jit 编译器)或 1 (使用较旧的64位 jit 编译器):Set the COMPLUS_useLegacyJit environment variable to either 0 (use the new 64-bit JIT compiler) or 1 (use the older 64-bit JIT compiler):

    COMPLUS_useLegacyJit=0|1  
    

    环境变量具有全局作用域,这意味着它会影响计算机上运行的所有应用程序。The environment variable has global scope, which means that it affects all applications run on the machine. 如果已设置,则它可以被应用程序配置文件设置重写。If set, it can be overridden by the application configuration file setting. 环境变量名称不区分大小写。The environment variable name is not case-sensitive.

  • 添加注册表项Adding a registry key

    可以通过将 REG_DWORD 值添加到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework 注册表中的或键来启用旧的64位 JIT 编译器 HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFrameworkYou can enable the legacy 64-bit JIT compiler by adding a REG_DWORD value to either the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework or HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework key in the registry. 此值的名称为 useLegacyJitThe value is named useLegacyJit. 如果该值为0,则使用新编译器。If the value is 0, the new compiler is used. 如果值为1,则启用旧版64位 JIT 编译器。If the value is 1, the legacy 64-bit JIT compiler is enabled. 注册表值名称不区分大小写。The registry value name is not case-sensitive.

    将该值添加到 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework 密钥会影响计算机上运行的所有应用。Adding the value to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework key affects all apps running on the machine. 将该值添加到 HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework 密钥会影响当前用户运行的所有应用。Adding the value to the HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework key affects all apps run by the current user. 如果使用多个用户帐户配置了计算机,则只有当前用户运行的应用才会受到影响,除非还将该值添加到其他用户的注册表项。If a machine is configured with multiple user accounts, only apps run by the current user are affected, unless the value is added to the registry keys for other users as well. 如果将 <useLegacyJit> 元素添加到配置文件中,将重写注册表设置(如果存在)。Adding the <useLegacyJit> element to a configuration file overrides the registry settings, if they're present.

示例Example

下面的配置文件使用新的64位 JIT 编译器禁用编译,而改用旧的64位 JIT 编译器。The following configuration file disables compilation with the new 64-bit JIT compiler and instead uses the legacy 64-bit JIT compiler.

<?xml version ="1.0"?>  
<configuration>  
  <runtime>  
    <useLegacyJit enabled="1" />  
  </runtime>  
</configuration>  

另请参阅See also