强制 .NET 应用程序以 32 位运行的环境变量 [英] Environment variable to force .NET applications to run as 32bit

查看:29
本文介绍了强制 .NET 应用程序以 32 位运行的环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人告诉我有一个环境变量,您可以设置它来强制 .NET 应用程序在 x64 版本的 Windows 上作为 32 位应用程序运行.你知道它是什么,或者知道它的参考资料吗?恐怕我的 google-fu 今天失败了(或者它不存在).

I've been told there is an environment variable you can set to force .NET applications to run as 32bit applications on x64 versions of Windows. Do you know what it is, or know of a reference on it? I'm afraid my google-fu has failed me today (or it doesn't exist).

我正在使用 Resolver One(一个 .NET 电子表格)并希望在不修改可执行文件的情况下访问某些仅限 32 位的功能.如果我可以从环境变量中配置它,那么我可以在需要时访问 32 位功能,但也可以在需要时作为 64 位应用程序运行.

I'm using Resolver One (a .NET spreadsheet) and want to access some 32bit only functionality without modifying the executable. If I can configure this from an environment variable then I can access 32bit functionality when needed but also run as a 64bit app when needed.

(注意:实际上,我希望能够在启动时切换应用程序以 32 位还是 64 位运行,而不是在编译时强制运行.)

(NOTE: effectively I want to be able to switch whether an application runs as 32bit or 64bit at launch time instead of forcing it at compile time.)

谢谢

推荐答案

我从 Dino Veihland(Microsoft IronPython 开发人员)那里得到了答案.我还没来得及测试它...

I've had an answer from Dino Veihland (Microsoft IronPython developer). I haven't had time to test it yet...

是 COMPLUS_ENABLE_64BIT.我认为将其设置为 0 会禁用 64 位.

It's COMPLUS_ENABLE_64BIT. I think setting it to 0 disables 64-bit.

您应该能够将其设置为 env var 或向 HKLMSoftwareMicrosoft.NETFramework 添加一个名为Enable_64Bit"、类型为 REG_DWORD 和值 0 的值以全局设置它(这就是所有COMPlus_* 变量工作).这个可能足够特别(它必须在创建进程之前运行),必须在 reg 键中设置它,但我并不完全确定.

You should be able to set it as an env var or add a value to HKLMSoftwareMicrosoft.NETFramework with the name "Enable_64Bit", the type REG_DWORD and the value 0 to set it globally (this is how all the COMPlus_* vars work). This one might be special enough (it has to run before the process is created) that it has to be set in the reg key but I'm not entirely certain.

这篇关于强制 .NET 应用程序以 32 位运行的环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆