具有许多强制 32 位程序集的应用程序
我有一个包含许多程序集和第三方实用程序的 VS 解决方案。我需要在 64 位计算机上运行时强制应用程序运行 32 位。该应用程序在 32 位计算机上运行良好。我强制 .exe 文件仅需要 32 位,当在 64 位计算机上运行时,我收到“尝试加载格式不正确的程序”错误。据我了解,更改 exe 会强制所有程序集作为 32 位加载。到底是怎么回事?
I have a VS solution with many assemblies and third-party utilities. I need to force the app to run 32-bit when running on a 64-bit machine. The app runs just fine on a 32-bit machine. I forced the .exe file to be only 32-bit required and when run on the 64-bit machine, I am getting "an attempt was made to load a program with an incorrect format" error. It was my understanding that changing the exe would force all the assemblies to load as 32-bit. What is going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道这是一个老问题;也许你已经找到了答案。
我不熟悉设置 ILONLY 和 32BITREQUIRED...通常在编译之前在编译器下拉框中选择 x86 而不是 ANYCPU 来处理您需要的一切。您还可以在配置管理器中验证所有应用程序是否都设置为编译为 x86。
最有可能的是,您遇到的情况是您的第三方实用程序之一在 64 位计算机上安装了 64 位 DLL,并且您的强制 32 位应用程序正在尝试加载 64 位 DLL。如果第三方 DLL 有 32 位和 64 位版本,安装程序很可能足够聪明,知道要安装哪一个。
在64位机器上你可以去两个地方检查:
HTH!
詹姆斯
I know this is an old question; maybe you already found your answer.
I'm not familiar with setting ILONLY and 32BITREQUIRED... usually choosing x86 instead of ANYCPU in the compiler drop-down box before compiling takes care of everything you need. You can verify that all your apps are set to compile to x86 in the configuration manager, as well.
Most likely, what you're running into is that one of your third-party utilities installed a 64-bit DLL on the 64-bit machine, and your forced-32-bit application is trying to load a 64-bit DLL. If a third-party DLL has a 32-bit and 64-bit version, chances are the installer is smart enough to know which one to lay down.
Two places you can go on the 64-bit machine to check:
HTH!
James