Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Generate Interop Assemblies from Type Libraries 

The Type Library Importer (Tlbimp.exe) is a command-line tool that converts the coclasses and interfaces contained in a COM type library to metadata. This tool creates an interop assembly and namespace for the type information automatically. After the metadata of a class is available, managed clients can create instances of the COM type and call its methods, just as if it were a .NET instance. Tlbimp.exe converts an entire type library to metadata at once and cannot generate type information for a subset of the types defined in a type library.

To generate an interop assembly from a type library

  • Use the following command:

    tlbimp <type-library-file>

    Adding the /out: switch produces an interop assembly with an altered name, such as LOANLib.dll. Altering the interop assembly name can help distinguish it from the original COM DLL and prevent problems that can occur from having duplicate names.

Example

The following command produces the Loanlib.dll assembly in the Loanlib namespace.

tlbimp Loanlib.dll

The following command produces an interop assembly with an altered name (LOANLib.dll).

tlbimp LoanLib.dll /out: LOANLib.dll

See Also

Community Additions

ADD
Show:
© 2015 Microsoft