How to generate type library from unmanaged COM dll

RoboAlex picture RoboAlex · Feb 14, 2011 · Viewed 28.4k times · Source

I have to use third party, unmanaged COM dll into my .NET application. I need to modify this assembly to produce a custom RCW. In order to Edit Interop Assembly I need the type library of the particular assembly. Can any one explain me that how to How to generate type library from unmanaged COM dll?

There is no option in regsvr32 to generate type library.

Thank you, Best Regards, Robo.

Answer

Guido Domenici picture Guido Domenici · Feb 14, 2011

You need the OLE-COM Object Viewer, available as part of whatever is the latest Windows SDK. Then you can go to File->View Type Lib and save the IDL to a text file. Then you can use MIDL (also part of the Windows SDK) to regenerate a TLB and header file. Something like this should do for basic cases:

midl /out c:\temp /header MyHeader.h MyIDLFile.idl