<useLegacyJit> 元素<useLegacyJit> Element

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

<configuration><configuration>
<运行时 ><runtime>
<useLegacyJit><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 attribute

“值”Value DescriptionDescription
00 公共语言运行时使用新的 64 位 JIT 编译器包含在.NET Framework 4.6 和更高版本。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

NoneNone

父元素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 开始,公共语言运行时使用新的 64 位编译器用于实时 (JIT) 编译默认情况下。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. 在某些情况下,这可能会导致已 JIT 编译的 64 位 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

    可以通过添加启用旧版 64 位 JIT 编译器REG_DWORD为值HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFrameworkHKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework密钥在注册表中。You 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