How to call C# DLL function from VBScript

后端 未结 2 1303
时光取名叫无心
时光取名叫无心 2020-11-27 05:28

I have my script on server, so I do not have UI interaction available and have to use DLL instead of console application.

How to call a function in C# DLL from VBScr

相关标签:
2条回答
  • 2020-11-27 06:27

    You need to mark your assembly as COM visible by setting the COMVisibleAttribute to true (either at assembly level or at class level if you want to expose only a single type).

    Next you register it with:

    regasm /codebase MyAssembly.dll
    

    and finally call it from VBScript:

    dim myObj
    Set myObj = CreateObject("MyNamespace.MyObject")
    
    0 讨论(0)
  • 2020-11-27 06:27

    Yes you will need to set the ComVisible attribute to true and then register the assembly using regasm or regsvcs along with tlbexp. Then you can use Server.CreateObject and sail through.

    0 讨论(0)
提交回复
热议问题