Search code examples
c++comunmanagedregsvr32typelib

How to generate type library from unmanaged COM dll


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.


Solution

  • If all you're trying to do is create an Interop Assembly from a native dll (and the native DLL embeds the TLB as a resource), you can just call tlbimp directly on the dll:

    tlbimp Foo.dll /out:Interop.Foo.dll

    Which will generate Interop.Foo.dll. You can then use ildasm to modify the IL:

    ildasm Interop.Foo.dll /out=Foo.il