简体   繁体   English

具有许多强制32位的程序集的App

[英]App with many assemblies forcing 32-bit

I have a VS solution with many assemblies and third-party utilities. 我有一个带有许多程序集和第三方实用程序的VS解决方案。 I need to force the app to run 32-bit when running on a 64-bit machine. 在64位计算机上运行时,我需要强制该应用程序运行32位。 The app runs just fine on a 32-bit machine. 该应用程序可以在32位计算机上正常运行。 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. 我强迫.exe文件只需要32位,并且在64位计算机上运行时,出现“试图加载格式不正确的程序”错误。 It was my understanding that changing the exe would force all the assemblies to load as 32-bit. 据我了解,更改exe会强制所有程序集加载为32位。 What is going on? 到底是怎么回事?

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. 我不熟悉设置ILONLY和32BITREQUIRED ...通常在编译之前会在编译器下拉框中选择x86而不是ANYCPU,从而满足您的所有需求。 You can verify that all your apps are set to compile to x86 in the configuration manager, as well. 您还可以在配置管理器中验证所有应用程序都设置为可编译为x86。

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. 您最有可能遇到的情况是,您的一个第三方实用程序在64位计算机上安装了64位DLL,而您的强制32位应用程序正在尝试加载64位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. 如果第三方DLL具有32位和64位版本,则安装程序很可能很聪明地知道要放下哪个。

Two places you can go on the 64-bit machine to check: 您可以在64位计算机上检查两个位置:

  1. If the program installed to C:\\Program Files\\, it's a 64-bit DLL; 如果程序安装到C:\\ Program Files \\,则为64位DLL; otherwise it would have been installed to C:\\Program Files (x86)\\ 否则它将被安装到C:\\ Program Files(x86)\\
  2. Navigate to the GAC from the command line: c:\\Windows\\assembly and look under GAC_32 vs. GAC_64. 从命令行导航到GAC:c:\\ Windows \\ assembly,然后在GAC_32 vs. GAC_64下查看。 If you find it under GAC_64, you're trying to load the 64-bit DLL 如果您在GAC_64下找到它,则尝试加载64位DLL。

HTH! HTH! James 詹姆士

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM