VBScript code not calling c# function

2019-07-18 07:21发布

问题:

I have created a C# dll and registerd as Com object. (Used ProgID, Set Comvisible True and Sign the assembly using Strong name).

I am trying to call c# method using the below vbscript code

Option Explicit 
Dim testwfhandler 
Set testwfhandler= CreateObject("CoreComponentWorkflow.WorkflowHandler") 
If Not testwfhandler Is Nothing Then     
Call testwfhandler.test()     
End If 
Set testwfhandler= Nothing 

am i missing anything? or am doing anything wrong?

The below is the registry informaton of my registered dll.

回答1:

Make sure you have set ComVisible to True for the C# assembly

Register the assembly using:

regasm /codebase YourAssembly.dll

Then call it as you have above.