Type Library Importer in Managed Code

Rating:        Based on 7 ratings
Reviewed:  5 reviews
Downloads: 26187
Released: Dec 8, 2009
Updated: Dec 8, 2009 by YiZhang
Dev status: Stable Help Icon

Recommended Download

Application Tlbimp in Managed Code Executable
application, 900K, uploaded Dec 8, 2009 - 21023 downloads

Other Available Downloads

Source Code Tlbimp in Managed Code Source
source code, 7204K, uploaded Dec 8, 2009 - 3552 downloads
Application TlbImp Regression Test Tool
application, 6477K, uploaded Mar 13, 2009 - 1612 downloads

Release Notes

TLBIMP is a .NET SDK tool that creates an Interop assembly from a COM type library. This project is a managed code implementation of TLBIMP. We have released this tool so developers can see what TLBIMP does and if necessary extend the tool for their specific requirements, while this is the third Tlbimp release on CodePlex.

A big feature is added to this release: Tlbimp output customization. With this feature, some special needs of importing convention can be handled when a type library is being imported by creating a configuration file in xml format, instead of leaving it later by disassembling an interop assembly to update the code. The current version supports the following configuration action:
  • ChangeManagedName: To provide a tlb type with a customized managed name instead of the default one.
  • ResolveTo: To resolve a tlb type to a user-specified managed type.
  • AddAttribute: To add some customized attribute to the corresponding managed types of the tlb types.
  • PreserveSig: To apply PreserveSig attribute to a managed function instead of [out, retval] parameters.
  • ConvertTo: To convert a tlb function parameter to the user-specified managed signature.
The new Tlbimp in the package accept the following command-line syntax to integrate the customized rule into its importing process:

> tlbimp ATlb.tlb /config:AXMLConfigFile.xml

A UI tool, TlbimpRuleFileEditor, can be found in the package for customization purpose, which help to create a configuration file without requiring knowledge of xml configuration file syntax. More introduction can be found in the document attached with the project.

The package also includes some tests, which can be used with Tlbimp Regression Test Tool (attached in the package as well) to validate any updates made against the original source code. More information about this tool can be found in the document in the package.

Other features introduced in the previous releases, are two command-line switches as the follows:
  • /v2: When this switch is on, the Tlbimp applies new rules when importing native types so as to get the output more as expected result. The new rule in this release is to convert VARIANT_BOOL in structures to bool instead of short.
  • /PreserveSig: If this swtich is applied, the Tlbimp doesn't apply [out, retval] parameter transformation but adds PreserveSigAttribute to the imported method.
To get the help for the command-line tool, please type in "tlbimp /?" in the command line, or check MSDN document library for the features in .NET 3.5 SDK.

Update: Ported some bug fixes from Tlbimp in .NET framework v4.0

Reviews for this release

It is varry useful
by s0201428 on Aug 9, 2010 at 10:16 AM
Wonderful to have the PreserveSig option available as well as rules to resolve interfaces such as IStream!
by decaf on Mar 22, 2010 at 2:58 PM
Helps avoiding manual ildasm/edit/ilasm tasks. Thank you!
by dpomt on Feb 22, 2010 at 9:13 AM
Great, now I can extend it with the features I have been waiting for.
by DesDesDes on Dec 19, 2008 at 11:27 AM
Thank you for fast bug fixing.
by sergey_shandar on Oct 28, 2008 at 5:47 AM