7

I want to know if it's possible to register a type library without using the RegAsm tool. Here is my situation, which will hopefully explain why I want to do this:

I'm developing an assembly in .NET that will provide some modern functionality for our older VB6 applications. I have successfully registered the assembly and the type library on my development machine using RegAsm like so:

regasm.exe MyAssembly.dll /tlb /codebase

The above command generates the type library (MyAssembly.tlb) and registers it as well as registering the assembly. I need the type library registered so that I can have Intellisense in VB6.

My problem with this method is that I don't have the same level of control when generating the type library file as I do with TlbExp.exe. In particular, I need to use TlbExp's /names flag to specify the proper case of my property names (RegAsm butchers them). So if I use TlbExp to generate my tlb file, is there any way that I can register it separately from the assembly registration process?

Edit: da_m_n's answer is correct for the question I asked. However, I was under the faulty assumption that just because RegAsm could register a type library that it was necessary to register the tlb in order reference it in VB6. So for now I'm registering the assembly and referencing the unregistered, TlbExp-generated tlb with the fixed names.

Kyle Gagnet
  • 2,294
  • 2
  • 20
  • 27
  • Actually, I think I might be mistaken in the assumption that I must register the tlb file in order to reference it in VB6. Perhaps this question is for nothing. I'll look into it tomorrow. – Kyle Gagnet Mar 03 '10 at 23:05
  • And now I can't find regtlib.exe on my computer. I can find regtlibv12.exe but no documentation at all. Looks to me like MS is no longer keen on .NET anymore. – Agnel Kurian Jan 06 '12 at 06:46

2 Answers2

5

Use regtlib.exe to register the tlbexp generated tlb file.

da_m_n
  • 821
  • 7
  • 10
2

regtlib.exe is not available on Win10 platforms. Use the appropriate TlbExp.exe as found in the corresponding .NET SDK (e.g. "%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\TlbExp.exe" "$(TargetDir)$(TargetFileName)" see https://learn.microsoft.com/en-us/dotnet/framework/tools/tlbexp-exe-type-library-exporter).

ergohack
  • 1,268
  • 15
  • 27
  • 1
    Tlbexp.exe generates a type library but does not register it. This is in contrast to the Assembly Registration tool (Regasm.exe), which both generates and registers a type library. To generate and register a type library with COM, use Regasm.exe. – EduBic Nov 30 '20 at 09:45
  • @EduBic, good insight, ... But on a build machine, where the executables are not run, just packaged, one might only need the type library built. – ergohack Nov 30 '20 at 16:17