CorFlags.exe(CorFlags 转换工具)CorFlags.exe (CorFlags Conversion Tool)

利用 CorFlags 转换工具,你配置可移植可执行映像标头的 CorFlags 部分。The CorFlags Conversion tool allows you to configure the CorFlags section of the header of a portable executable image.

此工具会自动随 Visual Studio 一起安装。This tool is automatically installed with Visual Studio. 若要运行此工具,请使用 Visual Studio 开发人员命令提示(或 Windows 7 中的 Visual Studio 命令提示)。To run the tool, use the Developer Command Prompt for Visual Studio (or the Visual Studio Command Prompt in Windows 7). 有关详细信息,请参阅命令提示For more information, see Command Prompts.

在命令提示符处,键入以下内容:At the command prompt, type the following:

语法Syntax

CorFlags.exe assembly [options]  

参数Parameters

必选参数Required parameter 说明Description
assembly 要为其配置 CorFlags 的程序集的名称。The name of the assembly for which to configure the CorFlags.
选项Option 说明Description
/32BIT[REQ]+/32BIT[REQ]+ 设置 32BITREQUIRED 标志。Sets the 32BITREQUIRED flag.
/32BIT[REQ]-/32BIT[REQ]- 清除 32BITREQUIRED 标志。Clears the 32BITREQUIRED flag.
/32BITPREF+/32BITPREF+ 设置 32BITPREFERRED 标志。Sets the 32BITPREFERRED flag. 该应用程序甚至可以作为 32 位进程在 64 位平台上运行。The app runs as a 32-bit process even on 64-bit platforms. 仅在 EXE 文件中设置此标志。Set this flag only on EXE files. 如果在 DLL 上设置此标志,则 DLL 将无法在 64 位进程中加载,并引发 BadImageFormatException 异常。If the flag is set on a DLL, the DLL fails to load in 64-bit processes, and a BadImageFormatException exception is thrown. 具有此标志的 EXE 文件可以加载到 64 位进程中。An EXE file with this flag can be loaded into a 64-bit process.

.NET Framework 4.5.NET Framework 4.5 中是新增选项。New in the .NET Framework 4.5.NET Framework 4.5.
/32BITPREF-/32BITPREF- 清除 32BITPREFERRED 标志。Clears the 32BITPREFERRED flag.

.NET Framework 4.5.NET Framework 4.5 中是新增选项。New in the .NET Framework 4.5.NET Framework 4.5.
/?/? 显示该工具的命令语法和选项。Displays command syntax and options for the tool.
/Force/Force 强制执行更新,即使程序集具有强名称也是如此。Forces an update even if the assembly is strong-named. 重要提示: 如果更新具有强名称的程序集,则必须在执行其代码之前再次对其签名。Important: If you update a strong-named assembly, you must sign it again before executing its code.
/help/help 显示该工具的命令语法和选项。Displays command syntax and options for the tool.
/ILONLY+/ILONLY+ 设置 ILONLY 标志。Sets the ILONLY flag.
/ILONLY-/ILONLY- 清除 ILONLY 标志。Clears the ILONLY flag.
/nologo/nologo 取消显示 Microsoft 启动版权标志。Suppresses the Microsoft startup banner display.
/RevertCLRHeader/RevertCLRHeader 将 CLR 标头版本还原到 2.0。Reverts the CLR header version to 2.0.
/UpgradeCLRHeader/UpgradeCLRHeader 将 CLR 标头版本升级到 2.5。Upgrades the CLR header version to 2.5. 注意: 程序集必须具有 2.5 版或更高版本的 CLR 标头才能在本机运行。Note: Assemblies must have a CLR header version of 2.5 or greater to run natively.

备注Remarks

如果未指定任何选项,则 CorFlags 转换工具将显示指定程序集的标志。If no options are specified, the CorFlags Conversion tool displays the flags for the specified assembly.

请参阅See also