Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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://docs.microsoft.com/en-us/dotnet/framework/tools/tlbexp-exe-type-library-exporter).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top