我可以使用* .tlb文件,而无需使用Regasm到计算机上进行注册可以使用、机上、文件、tlb

2023-09-03 22:07:51 作者:撸串青年

我们的支持,我们在.net中写入新的code老龄化VB6系统,把code到组装,然后出口* .TLB文件与VB6 codeBase的使用。

We are supporting an aging VB6 system that we have written new code for in .Net, put the code into assemblies and then exported *.tlb files for use with the VB6 codebase.

我的问题是,在每台计算机上我想运行在code,我必须用Regasm注册类型库?

My question is, on every computer I wish to run the code on, do I have to use Regasm to register the type libraries?

我问,因为它变得很难跟踪类型库设施如电脑打破,新的计算机得到补充等。此外,如果我们更新.net code,我们需要去周围的每一个计算机,并重新注册该类型库。

I ask because it gets difficult to keep track of type library installations as computers break, new computers get added etc. Also, if we update the .Net code, we need to go around every computer and re-register the type library.

综上所述,是否有可能从VB6运行的.Net code无需注册类型库中的code运行在每台计算机上?

To sum up, is it possible to run .Net code from VB6 without having to register the type library on each computer the code is running on?

三江源

推荐答案

Regasm.exe仅创建当你与运行类型库的 /tlb:filename.tlb 命令行选项。你然后在VB6项目,项目+参考使用,浏览按钮来接.tlb文件。运行Tlbexp.exe是另一种方式得到它,减去注册。而且一个你应该preFER,在IDE中注册为COM互操作选项。然而,你必须运行VS升高,因此它可以写入注册表。用鼠标右键单击该快捷方式,选择以管理员身份运行。

Regasm.exe only creates a type library when you run it with the /tlb:filename.tlb command line option. Which you then use in a VB6 project with Project + References, Browse button to pick the .tlb file. Running Tlbexp.exe is another way to get it, minus the registration. And the one you ought to prefer, the "Register for COM interop" option in the IDE. You however have to run VS elevated so it can write the registry. Right-click the shortcut and select "Run as Administrator".

有它出现在VB6列表是一个小的方便,但是这是很难得到的。标准的.NET注册code调用Regasm.exe不写所需的可编程键进入VB6的组件会自动添加到列表中。你必须写的[ComRegisterFunction]属性写入缺少键饰定制注册功能。这是不值得的,当你可以简单地点击浏览。

Having it appear in the VB6 list is a small convenience but that is hard to get. The standard .NET registration code called by Regasm.exe doesn't write the required "Programmable" key to get VB6 to add the component to its list automatically. You have to write a custom registration function decorated by the [ComRegisterFunction] attribute that writes the missing key. It isn't worth it when you can simply click Browse.

另外请注意,你的没有的必须注册用户的计算机上的类型库。它仅需要VB6的编译器。你必须注册[标记有ComVisible特性]类,很容易与安装项目。就在DLL的注册属性设置为vsdrpCOM。

Also note that you do not have to register the type library on the user's machine. It is only needed by the VB6 compiler. You do have to register the [ComVisible] classes, it is easy with a Setup project. Just set the Register property of the DLL to vsdrpCOM.

 
精彩推荐
图片推荐