.net – Running 32 bit app using 32 bit com on a 64 bit Windows machine

64-bitcomjitnet

I have a C# application using C++ COM object both build on a 32 bit machine. Now I have to run them on a 64 bit machine. I registered the COM object. A corresponding entry was created in the register under computer\hkey_classes_root\wow6432node\clsid{xxx}.
However, when I try to run the application it says that |"Retrieving the COM class factory for component with CLSID {xxx} failed due to the following error: 80040154.". As I understand, the error code means that the class is not registered.
Please, help!!!
Thanks

Best Answer

The first answer above is the correct answer. You cannot run a CPU ANY target application on 64 bit Windows if you reference a 32 bit COM component. It will not load.

What is happening is that the JIT is seeing CPU ANY and promoting your App to 64 bit. But there is no 64 bit version of the com control and hence you get the not registered error.

This is a big problem for people who use Microsoft Access for their database. There is no 64 bit version of Access, so when they see the error they think they need a 64 bit runtime (doesn't exist). You have to flag your app as 32 bit only in order to use the Access runtime.

This is a poor choice (IMHO) - find a better component that has a 64 bit version, or go 100% managed code.

I don't like to every tag apps as 32 bit only unless they REALLY need it.