COM Exception : 80040154, Manifest Already Provided

3

I'm developing my application using a 3rd party dll, it's a COM object. I'm trying to make my application isolated, using COM registration-free. But I can't really find good example/walkthough/tutorial on how to do all this. Please tell me whether what I did is correct or wrong.

I created the manifest for the original dll, generate a tyle library using tlbimp.exe, add the type library as reference to the project, instantiate the object normally. Even though I already provided the manifest file, I still getting this error :

System.Runtime.InteropServices.COMException was unhandled
Message=Retrieving the COM class factory for component with CLSID {7B3A2D19-1D82-4DF6-8939-B730058A5535} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Googled this, and it seems like a lot of people pointing to the build configuration, but I already set my build to use x86. I'm pretty sure the dll also was developed in x86 environment. (I don't know whether this is relevant or not..)

I did :

  • Provide external manifest without removing the internal RT_MANIFEST inside the dll.
  • Update the RT_MANIFEST using mt.exe.
  • Use the type library that was generated by both of the above.

Btw, I am also curious which of the FILEVERSION or PRODUCTVERSION number that I should use for the version element inside the manifest? (I tried both, neither worked)

Properties showing FileVersion and ProductVersion

Please tell me where did I do wrong? Did I provide wrong information for the manifest? How do I know what information do I need more for the manifest?

Please do let me know if you need further information. Thanks to all.

c#
manifest
com-interop
asked on Stack Overflow Apr 10, 2012 by farid JAD7 • edited Aug 18, 2019 by Glorfindel

1 Answer

1

It's probably due to this step:

Provide external manifest without removing the internal RT_MANIFEST inside the dll.

Starting with Windows Server 2003 SP1 Windows will ignore an internal manifest if a file has an internal manifest. You can try registry setting HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\PreferExternalManifest (DWORD) to 1 as mentioned on this blog and in the KB article. This will make Windows look at the external manifest instead of the internal.

However if you are installing this on multiple systems you would have to set this flag on every system you install all. And this setting is a global setting - affecting all applications, so that is probably not a good idea.

answered on Stack Overflow Apr 10, 2012 by shf301

User contributions licensed under CC BY-SA 3.0