Making a DLL COM accessible

[亡魂溺海] 提交于 2019-11-28 13:34:38

Step #6 is wrong. .NET assemblies with [ComVisible] types are registered with Regasm.exe. Use the /codebase command line option if you don't want to install the DLL into the GAC. The /tlb command line option creates the type library, you can use that in your VB6 project.

You'll need to define GUIDs for your interfaces and mark which classes implement which interfaces, to start. MSDN has a getting started guide. You don't need to run RegSvr32, but you do need to put the DLL somewhere where the app can find it:

After registering an assembly using Regasm.exe, you can install it in the global assembly cache so that it can be activated from any COM client. If the assembly is only going to be activated by a single application, you can place it in that application's directory.

There is also a good overview of the whole process here.

I am fairly certain RegSvr32 only works on non.NET DLL. .NET assemblies are stored in the Global Assembly Cache (GAC). You have to run the gacutil.exe.

Use GacUtil instead of RegSvr32. RegSvr is used for dll's made with VB6 and for the .NET DLL's you need to use GacUtil because it is added to the global assembly cache.

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