What is a TLB file?


What are tlb files?

A TLB file is a small file to help accessing a DLL. This is true for COM or DCOM object. You will use TLB files if for example you make a DLL with Visual Studio 2010 (C# or VB) and want to make if COM visible.
And the best example is when you make a DLL from Visual Studio using any new Framework such as NET 2.0, 3.0, 3.5, 4.0 or 4.5 and wish to make if useable inside any VBA editor (from Excel , Autocad, MicroStation, …)


How to create a TLB file?


First you need a DLL (COM or DCOM DLL). It is not important how you made your DLL (C# or VB). For example:
C: \temp\test.dll

Now, to create a TLB file and to be able to use it, you have to start a command line and run something like this if your DLL is a x86 type:
C:\Windows\Microsoft.NET\Framework\<VERSION>\REGASM.exe C: \temp\test.dll
/tlb:C:\temp\test.dll


If your DLL is a x64 type:
C:\Windows\Microsoft.NET\Framework64\<VERSION>\REGASM.exe C: \temp\test.dll
/tlb:C:\temp\test.dll

How to unregister or delete a TLB ?


This will only work if you previously register your DLL/TLB correctly. You also have to call the same Framework.  Adding the “/u” will do, check this example:
C:\Windows\Microsoft.NET\Framework\<VERSION>\REGASM.exe /u C: \temp\test.dll
/tlb:C:\temp\test.dll

Or
C:\Windows\Microsoft.NET\Framework64\<VERSION>\REGASM.exe /u C: \temp\test.dll
/tlb:C:\temp\test.dll

If your TLB is still available, try to delete it from the registry using REGEDIT. Normally, the entry is inside HKEY_CLASSES_ROOT.

You just need to search for “C:\temp\test.dll”

What do I need to know?

Well this text doesn’t say everything but I hope is helped a few of you.


References :

From MSDN :
COM, DCOM, and Type Libraries

Regasm.exe (Assembly Registration Tool)

Share this

Related Posts

Previous
Next Post »