Exposing.NET assembly as COM 101

Posted by Jan Zich on Stack Overflow See other posts from Stack Overflow or by Jan Zich
Published on 2010-03-25T11:41:59Z Indexed on 2010/03/25 11:53 UTC
Read the original article Hit count: 460

Filed under:
|
|

I have trouble to expose a .NET assembly in COM. It seems that I must be missing some basic step because I think I followed all tutorials and documentation I found as well as common sense, but still when I do (in a test VBScript):

Set o = CreateObject("MyLib.MyClass")

It keeps saying that the object cannot be created.

Here are the steps I have done:

  1. I have simple one method dummy class with no attributes.
  2. The class is in a class library which has "Make assembly COM-visible" ticked in Visual Studio.
  3. The class library is signed.
  4. The DLL is registered via RegAsm.exe with the /codebase parameter (I don’t want / cannot add the DLL to GAC).

Just to be sure, I tried to copy the library to the same directory as the test VBScript, but it does not help.

Edit: I should have mentioned that the I can instantiate the class in COM if I put the DLL into GAC.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about interop