How to register a legacy .TLB file in Windows 10 if regtlib12.exe is not available?

Manoj 86 Reputation points
2022-01-14T11:04:57.133+00:00

I want to register a .TLB file which I created by compiling an IDL file using the MIDL compiler. I cannot find the "regtlib12.exe" tool anywhere. I tried to register it by using "regasm" but it takes an assembly file as an argument, creates a tlb file and then registers it. It cannot register an existing tlb file.

So I created an assembly using "tlbimp.exe" from the tlb file and then tried to use "regasm" but it gave me the error:

CLR assembly '<path_to_dll>' was imported from a type library and cannot be re-exported to a type library. Make sure the type library from which the assembly was imported is registered.

So how can I register a tlb file without "regtlib12"? Is there a way to do this programmatically by using a msi installer or some other way?

Thanks
Manoj

Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 49,651 Reputation points
    2022-01-14T11:31:15.8+00:00

    I want to register a .TLB file which I created by compiling an IDL file using the MIDL compiler.

    The sample code at https://github.com/dotnet/samples/blob/main/core/extensions/OutOfProcCOM/COMRegistration/TypeLib.cs shows how to register a type library created using MIDL.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.