windows 在 64 位操作系统上以 32 位形式运行 AnyCPU 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1075363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:45:14  来源:igfitidea点击:

Running an AnyCPU application as 32-bit on a 64-bit OS

.netwindows64-bitexecutablecompilation

提问by statenjason

Is there a way to execute a .NET application compiled under AnyCPU as a 32-bit application when running in a 64-bit Windows environment without recompiling as x86?

在 64 位 Windows 环境中运行时,有没有办法将在 AnyCPU 下编译为 32 位应用程序的 .NET 应用程序执行,而无需重新编译为 x86?

采纳答案by Jonathan Rupp

You can use corflagswith the /32bit+ option.

您可以使用带有 /32bit+ 选项的corflags

回答by Reed Copsey

You can use CorFlagsto change the bit without compiling, but you need to modify the application itself to run it. There is no way to just run the app as 32bit directly.

您可以在不编译的情况下使用CorFlags更改位,但您需要修改应用程序本身才能运行它。无法直接将应用程序作为 32 位运行。

Alternatively, if you do not want to change the .exe at all, you can make a 32bit compiled application that loads the assembly and starts its entry point. Since you're loading the assembly into a running 32bit application, it will run as 32bit.

或者,如果您根本不想更改 .exe,您可以制作一个 32 位编译的应用程序来加载程序集并启动其入口点。由于您将程序集加载到正在运行的 32 位应用程序中,因此它将作为 32 位运行。

回答by statenjason

Found it. Need to change the corflags using corflags.exe as this blog explains.

找到了。如本博客所述,需要使用 corflags.exe 更改 corflags 。