简体   繁体   English

无法从vb6代码调用Com +

[英]Unable to call Com+ from vb6 code

I created a C# dll in vs 2010 with all Com+ attributes.i created a strong key,and this strong key to Application properties and register it to the assembly: sn -k ComPlusClass.snk 我在vs 2010中使用所有Com +属性创建了一个C#dll。我创建了一个强键,并将this strong key to Application properties and register it to the assembly: sn -k ComPlusClass.snk and register it to the assembly: sn -k ComPlusClass.snk

Use VS tool to register the assembly as: regasm ComPlusExample.DLL Use VS tool to register the assembly as: regasm ComPlusExample.DLL

Create a Type Library using the tool: ` tlbexp ComPlusExample.DLL Create a Type Library using the tool: `tlbexp ComPlusExample.DLL

Register it in COM+ as: regsvcs ComPlusExample.DLL later i created a application in vb6 and add generated .tlb in refrences.Everthing works fine. Register it in COM+ as: regsvcs ComPlusExample.DLL后来我在vb6中创建了一个应用程序,并在regsvcs ComPlusExample.DLL中添加了生成的.tlb。一切正常。 I am able to call c# dll from vb6. 我可以从vb6调用c#dll。 But i need to give this code to my client and it is not possible to run all these steps there. 但是我需要将此代码提供给我的客户端,并且不可能在那里运行所有这些步骤。 So for this i created exe by right click my app in COM+.i installed this exe on my client system.but when i added the refrence of tlb from progmramfiles it shows a error that module can't be found .plz help me in this regard.Is creating exe is the right way to export my com+ from one system to another.. 所以为此我通过右键单击我的应用程序在COM +中创建了exe。我在客户端系统上安装了此exe。但是当我从progmramfiles添加tlb的引用时,它显示了module can't be found的错误.plz在此帮助我考虑到。创建exe是将com +从一个系统导出到另一个系统的正确方法。

Your application relies on the .NET Framework so the "regsvcs" command must be run on the client machine in which you are deploying. 您的应用程序依赖于.NET Framework,因此“ regsvcs”命令必须在要部署的客户端计算机上运行。 If you simply export the library and import into COM+ I don't believe the necessary CCW (COM callable wrapper) entries are added to the Windows registry. 如果仅导出库并将其导入COM +,我认为Windows注册表中不会添加必要的CCW(COM可调用包装器)条目。

I would therefore recommend creating a batch file that runs the "regsvcs" command with the parameters you need. 因此,我建议创建一个批处理文件,该批处理文件使用所需的参数运行“ regsvcs”命令。 You will not need to generate the TLB file on the client since this is used at development time only. 您无需在客户端上生成TLB文件,因为该文件仅在开发时使用。

Of course you could also create a project installer that does this for you but if you are looking for a quick solution the batch file will do it. 当然,您也可以创建一个为您执行此操作的项目安装程序,但是如果您正在寻找一种快速的解决方案,则批处理文件可以做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM