2

I need to access a x86 dll (3rd party, no access to source) from x64 code. My research indicated putting the dll in a COM+ wrapper and accessing as an OOP service was the most suitable approach.

So far so good.

So following a guide from "NET 2.0 Interoperability Recipes - A Problem Solution Approach" (although I am running VS2010, and .NET4). I built a proof of concept Service(dll) and test Client(exe), the service running as a server application to be OOP. They both work, and disabling the service through Component Services kills it, so it appears to be using the correct route.

This is all in x86.

When I change the client to x64 I get a 'BadImageFormatException', which I would expect if it were simply loading an x86 dll, but this should be running OOP.

I know I am missing something, and it is probably quite obvious.

Other Notes:

1) I run regsvcs post build, and regsvcs /u prebuild 2) The problem dll is stuck as is, and my main codebase has to be x64

4

1 回答 1

0

您需要强制您的程序在所有平台上以 x86 模式运行。进入主程序集的属性并在“构建”选项卡中,将“平台目标”从“任何 CPU”更改为“x86”。这将强制所有程序集以 x86 模式运行,即使在 x64 机器上也是如此。

于 2012-07-11T10:08:32.957 回答