如何编程设置或清除32BIT标志? [英] How to programatically set or clear the 32BIT flag?

查看:285
本文介绍了如何编程设置或清除32BIT标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编译时,我总是将它设置为任何CPU。然而,有一个x64系统上运行时,一些客户没有所需的二进制文件的64位版本,甚至。在这种情况下,我已要求他们修改我的二进制与corflags.exe / 32BIT +选项:

When compiling, I always set it for Any CPU. However there are some customers that do not have a 64 bit version of a required binary, even when running on an x64 system. In these instances I have asked them to modify my binary with the corflags.exe /32BIT+ option:

http://msdn.microsoft.com/en-us/library/ms164699(VS.80)的.aspx

我想使这个透明和修改二元自己在安装时,如果64位版本不存在。我会的喜欢不要拨打电话到corflags.exe自己作为这将意味着我需要重新分配这是不允许作为我们的运输要求的部分应用程序。

I would like to make this transparent and modify the binary myself during installation time if the 64 bit version is not present. I would prefer not to make a call to corflags.exe myself as that would mean I would need to redistribute the application which is not allowed as part of our shipping requirements.

所以我的问题是;有没有办法以编程方式修改此标志自己,或者直接修改二进制文件(是它只是文件本身某处设置一个字节)?

So my question is; is there any way to modify this flag programatically myself, or alternatively to modify the binary directly (is it just setting a byte somewhere in the file itself)?

推荐答案

为什么不建立自己的组件两种架构(32位和64位)具体而言,包括在你的安装程序,然后在安装时,检测你的客户有此依赖程序集的版本,然后安装应用程序的适当架构的版本。这种方式有各地手动修改二进制文件或需要包括在您安装corflags没有搞乱。

Why not just build your assemblies for both architectures (32-bit and 64-bit) specifically, include both in your installer, and then at install time, detect which version of this dependent assembly your client has and then install the appropriate architecture version of your application. This way there's no messing around modifying binaries manually or needing to include corflags in your installer.

这篇关于如何编程设置或清除32BIT标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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