ClickOnce的:BadImageFormatException在64位Windows上运行的x86包时 [英] ClickOnce: BadImageFormatException when running x86 package on 64 bit windows

查看:295
本文介绍了ClickOnce的:BadImageFormatException在64位Windows上运行的x86包时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.NET 2.0应用程序导入非托管的32位DLL。 该dll被加载(第一个互操作调用发生),当用户通过应用程序中的对话框打开一个文件。

My .NET 2.0 application imports unmanaged 32 bit dll. The dll is loaded (first interop call happens) when user opens a file via a dialog within the application.

当我部署通过的ClickOnce应用程序与目标平台试图从应用程序中打开文件时的任何,在64位Windows用户获得BadImageFormatException(此刻的非托管的DLL加载)。据我所知,这是由于64位进程的incompabible位元与32位非托管DLL。

When I deploy the application via clickonce with target platform "Any", users on 64 bit windows get BadImageFormatException when trying to open files from the application (at the moment the unmanaged dll is loaded). I understand this is due to incompabible bitness of the 64 bit process and the 32 bit unmanaged dll.

我已经重新部署使用86作为目标平台的应用程序。据我所知,这应该解决的位数的问题。

I have redeployed the application using x86 as target platform. As I understand it, this should solve the bitness problem.

当我运行在部署应用程序专为x86的64位系统,我现在得到BadImageFormatException的应用程序,甚至立即开始之前。测试至少有3个64位的机器。在32位机器,它的工作原理没有问题。

When I run the deployed application built for x86 on 64 bit system, I now get BadImageFormatException immediately before the application even starts. Tested on at least three 64 bit machines. On 32 bit machines, it works with no problem.

当我运行应用程序直接从VS(或不直接,只是一个正常身材,而不是通过ClickOnce的打算),在使用的x86目标平台的时候是在64位的Windows没有问题。应用程序启动和用户可加载文件 - 互操作调用成功

When I run the application directly from VS (or not directly, just a normal build, not going via ClickOnce), there is no problem on 64 bit windows when using x86 target platform. The application starts and user can load file - the interop call succeeds.

我一直在调试这2天直,没有结果 - 我已经尝试了不同的计算机上。这似乎consistentnly对我已经试过其中一台计算机的工作。但是,我没有永久访问这台计算机。

I have been debugging this for 2 days straight with no result - I have tried on different computers. It seems to consistentnly work on one of the computers I have tried. However, I do not have permanent access to this computer.

我已成功地建立ClickOnce部署我的电脑上,一旦和它的工作在64位计算机上。这是单一的,也许100次尝试!一切都没有改变,唯一改变的变量是,我的计算机重新启动后,立即做了成功的构建。

I have managed to build the ClickOnce deployment on my computer once and it worked on a 64 bit machine. This was single of maybe 100 tries! Nothing has changed, the only changed variable was that I did the successful build immediately after computer restart.

我做清洁/重建/重启VS /重新启动windows多次。我重新安装了VS 2008现在还包括整个操作系统,它并没有帮助。

I did clean/rebuild/restart VS/restart windows MANY times. I have reinstalled VS 2008 and now also the whole OS, it did not help.


编辑:我刚才设法得到一个好身材(出未来100 :)),并做了部署目录之间的比较。 问题的根源在于ClickOnce的产生了错误的目标平台的主要.exe文件的清单:

I have just managed to get one good build (out of next 100 :)) and did comparison between the deployed directories. The source of the problem is that ClickOnce generates the wrong target platform in the manifest of the main .exe:

<asmv1:assemblyIdentity name="app.exe" version="1.0.4.18" publicKeyToken=".token here." language="neutral" processorArchitecture="<b>msil</b>" type="win32" />

的ProcessorArchitecture应该是86。

processorArchitecture should be x86.

所以现在的问题是如何持续力与部署时生成正确的ProcessorArchitecture在清单中。

So the question is how to consistently force VS to generate the correct processorArchitecture in the manifest when deploying.

任何人都可以帮助吗?

推荐答案

这是通过安装VS 2008 SP1在64位Windows 7 VS2008的XP SP1有问题,在两台机器上我曾尝试与解决。

This was resolved by installing VS 2008 SP1 on 64 bit Windows 7. VS2008 SP1 on XP had the problem on two machines I have tried with.

这篇关于ClickOnce的:BadImageFormatException在64位Windows上运行的x86包时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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