views:

3081

answers:

2

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

How to call a function in C# DLL from VBScript?

Have I make my DLL to be COMVisible? Have I to register it?

+7  A: 

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")
Darin Dimitrov
+1  A: 

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.

danish