Visual Studio 2010 64-bit COM Interop Issue

Posted by Adam Driscoll on Stack Overflow See other posts from Stack Overflow or by Adam Driscoll
Published on 2010-03-15T21:09:52Z Indexed on 2010/03/16 19:11 UTC
Read the original article Hit count: 963

Filed under:
|
|
|

I am trying to add a VC6 COM DLL to our VS2010RC C# solution. The DLL was compiled with the VC6 tools to create an x86 version and was compiled with the VC7 Cross-platform tools to generate a VC7 DLL.

The x86 version of the assembly works fine as long as the consuming C# project's platform is set to x86. It doesn't matter whether the x64 or the x86 version of the DLL is actually registered. It works with both. If the platform is set to 'Any CPU' I receive a BadImageFormatException on the load of the Interop.<name>.dll.

As for the x64 version, I cannot even get the project to build. I receive the tlbimp error:

TlbImp : error TI0000: A single valid machine type compatible with the input type library must be specified.

Has anyone seen this issue?

EDIT:

I've done a lot more digging into this issue and think this may be a Visual Studio bug. I have a clean solution. I bring in my COM assembly with language agnostic 'Any CPU' selected. The process architecture of the resulting Interop DLL is x86 rather than MSIL.

May have to make the Interop by hand for now to get this to work.

If anyone has another suggestion let me know.

© Stack Overflow or respective owner

Related posts about visual-studio-2010

Related posts about com