I have a .NET project that normally calls into 32-bit COM objects. I would like to port it to 64-bit but there is one COM object that must remain 32-bit.

When the project runs, it gives an error "Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80040154." The error is 'Class not registered'.

Having researched the issue, on 64-bit Windows my 32-bit COM dlls are registered in HKCR\Wow6432Node\CLSID instead of the normal HKCR\CLSID. When my .NET project runs in 32-bit, it looks to HKCR\Wow6432Node\CLSID and finds the correct object there. When it runs 64-bit, it looks to HKCR\CLSID and doesn't find it.

I thought if I compiled my interop assembly to only target 32-bit, it might work. However, the 64-bit app did not like working with the 32-bit interop assembly at all.

Does anyone know how to do this correctly

Re: 64-Bit .NET Framework Development. Calling 32-bit COM object fails 80040154

Feng Chen - MSFT

Hi sparticus,

Yes you can¡¯t use a 32bit in-process COM in your 64bit compiled .net application, because the COM library needs to load the COM dll into your application¡¯s process space.

To work around this issue, either recompile your application as 32bit or write a out-of-process COM component which wrap the 32bit COM DLL, and use this out-of-process COM component in your .net application. Check out this Creating the out of proc COM Server in C++. Or you can isolate the COM dll into a separate process using COM+, for more details, please visit How to Isolate a DLL into a Separate Process By Using Component Services.

Hope this helps!