x86 COM Interop in x64 Environment.

I encountered a problem with one of my application. It stops working when I executed it on Windows 2003 Server 64-bit. It threw an exception:

Retrieving the COM class factory for component with CLSID {GUID HERE} failed due to the following error: 80040154.

The COM interop is an x86 interop, and that causes the exception. To address this issue, I have to recompile the app and change the target platform from AnyCPU to x86. After that, it works great.

Comments

  • Anonymous
    April 18, 2007
    Hi,I got same problem like u.My Com interop is written by C++ and many c# projects reference this assembly.So I changed the target platform from AnyCPU to x86 for all the c# projects.Other problem comes,my applicatin nearly cannot run.Should all the project use the change.For example,res1 is a com assembly,and res2 reference res1 and another one res3,shoule I also change the res3 project to x86?Thanks!Any help,pls send me a mail to malio_82@126.com.

  • Anonymous
    April 19, 2007
    Malio, I do not have time to investigate, but my understanding is that your app has to be 32-bit, or your COM server is recompiled as 64-bit.  Again, I have not investigate this yet. Good luck!