1、类 顶部 添加代码段:

1 <ComVisible(True)>
2 <ClassInterface(ClassInterfaceType.AutoDual)>
3 Public Class MyClass
4 'public 方法
5 end class

注:紧贴类,不能有空行

为公开给 COM 的类指定要生成的类接口的类型(如果有接口生成)。

(调用的时候可以看到相关方法提示)

2、项目——属性——签名——新建

生成密钥文件

3、确定好 .net Framework 版本

4、生成DLL文件

5、新建 bat 注册文件(此处为 .net Framework   2.0 版本,具体版本修改绝对路径即可)

@echo off
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe %cd%\MyClass.dll /tlb: %cd%\MyClass.tlb /codebase
pause

注:XP系统需将DLL文件与bat文件都拷贝到System32 文件夹下运行注册

相关文章:

  • 2021-04-23
  • 2022-01-20
  • 2021-09-13
  • 2021-09-29
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
猜你喜欢
  • 2021-09-01
  • 2021-05-22
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
相关资源
相似解决方案