0

I upgrade Visual Studio Solution (90+ C# Projects) from .NET Framework 4.72 to .NET 6.

What is the difference between *.tlb and *.pdb files. When upgrading to .NET 6, I of course have to provide debugging information in .NET 6. I do not know, whether to register *.tlb or *.pdb files.

Could anybody clarify the following please:

  • Are *.tlb and *.pdb similar, except that .tlb are for COM Interop and *.pdb for regular .NET 6 applications? If they are different, what is the key difference?
  • When generating *.comhost.dll for COM Interop, should I generate and register *.pdb or *.tlb to provide debugging information?

As far as I understand, *.pdb files contain symbol information and *.tld files contain type libraries. My understanding is that both are practically the same thing and both provide debugging information?

Main information sources:

Jiale Xue - MSFT
  • 3,560
  • 1
  • 6
  • 21
Bunkai.Satori
  • 4,698
  • 13
  • 49
  • 77
  • 1
    PDB is Program Debug Database, it contains development symbols (exact content may vary from your project settings) and line/col position of code, they are tied to the binary (.dll, .exe) with the same name (blah.exe => blah.pdb). PDBs are only used by developpers. TLB has **nothing** to do with PDB. A .TLB contains a Type Library that is used at runtime and defines COM public interfaces, classes, etc. to potential clients capable of using them. Sometimes .TLB are embedded into .exe or .dll as Win32 resources. External .TLB should in general be registered to be usable. – Simon Mourier Oct 02 '22 at 15:13
  • @SimonMourier, so a scenario, where a COM Interop DLL needs to have both ".pdb" and "*.tlb" files registered is quite realistic and probably common, isn't? I understand, that those two are not mutually exclusive. In case of a "*.comhost.dll" for .NET 6, would you know, whether to generate/register "*.tlb" and ".pdb" for this ".comhost.dll" or for the original "*.dll" without ".comhost.dll" suffix? – Bunkai.Satori Oct 02 '22 at 15:41
  • 1
    It's your choice to distribute PDB with your binaries or not. For TLB, .NET core 3/5/6 brings quite a number of important breaking change from .NET framework in .NET COM support world. There's no support for building tlb nor for registering them. See my comments here for ways to do it with recent .NET https://stackoverflow.com/questions/73803662/com-interop-with-net-6#comment130330926_73803662 – Simon Mourier Oct 02 '22 at 15:49
  • @SimonMourier, I have read the other article. The key question that comes to my mind is that although ".TLD" approach is still supported by .NET5, .NET6, (as you wrote in that other article), is it possible that it would not be necessary anymore and would be replaced by ".comhost.dll" approach? – Bunkai.Satori Oct 02 '22 at 16:19
  • 1
    comhost is almost always the same binary that is referenced as the COM entry point and loads the .NET execution engine. This is has little do do with a type library. – Simon Mourier Oct 02 '22 at 17:48
  • 1
    The .pdb file takes care of itself, it is automatically present when you build the debug configuration of the project and has no use on the user's machine. I'll link to the Q+A that explains the role of the .tlb file. – Hans Passant Oct 03 '22 at 08:08

0 Answers0