COMException (0x80040154) Retrieving the COM class factory for component ... failed

From FxCodeBaseWiki
Jump to: navigation, search

Sometimes your .NET application can raise the following exception at the first call of Order2Go methods:

 System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with 
 CLSID {50E4D830-B0BD-4DB5-94DB-CC5AB547CDA9} failed due to the following error: 80040154.

This happens when .NET application which uses Win32 native code and which is compiled for AnyCPU target is executed on Win64 platform.

You know, Order2Go is Win32 native application and it remains native and 32 bit even if it is used from managed (.NET) application. Unfortunately, Microsoft's 64-bit .NET runtime cannot interoperate with 32-bit code. When the managed application is compiled for AnyCPU target, the 32-bit runtime is used on 32-bit systems and 64-bit runtime is used on 64-bit system. So, to make your application working, you must compile your application for x86 platform, so the 32-bit .NET runtime will be used even on 64-bit OS. To do that just specify /platform:x86 in your build script or specify x86 in the "target platform" build option of your project in IDE.

This Article in Other Languages

Language: English  • español