Jun 6, 2013

Convert typed library (.tlb) to .net assembly?

2 comments
Sometimes we have to use the legacy code(C, C++) in .Net projects which is provided by third party vendors. Most of the times these guys will provide, equivalent .net framework typed library (.tlb) of that legacy code.

Then, how to refer those in our .net projects and make use of functionality provided by it?  Follow the below steps,
  1. Keep ".tlb" file which is nothing but legacy typed library
  2. Open windows command prompt
  3. Go to directory, "C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin" or   "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin". It depends on which version of visual studio you had.
  4. Enter the following and execute, TlbImp.exe "E\MyLibrary.tlb". Here, replace "E:\MyLibrary.tlb" with path to your tlb file.

It will import the .net framework type library to assembly.i.e, .dll and it can be found at path "C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin" with name "MyLibraryLib.dll".


Now we can add reference to this assembly directly like any other .net dll in project and use the functionality of it. It's simple.

2 comments :

  1. Useful post.Dot Net is most supported programming tongue among programming engineers wherever all through the world. It is in like manner considered as most trusted and fruitful stage to build high performing desktop or endeavor application.
    Thanks,
    DOTNET Training in Chennai | DOTNET course in Chennai | DOTNET Training Institute in Chennai

    ReplyDelete