Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Interoperability
 How to: Generate Interop Assemblies...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Developer's Guide 
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

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Dependent libraries      Adam_Nathan   |   Edit   |   Show History
Any dependent type libraries must be registered or specified via tlbimp's /reference option in order for the import to be completely successful.  This is because TLB references are specified via LIBIDs only.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker