How to Register a Type Library without RegAsm.exe

房东的猫 提交于 2020-01-03 15:16:18

问题


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.


回答1:


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




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



来源:https://stackoverflow.com/questions/2375585/how-to-register-a-type-library-without-regasm-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!