2
votes

I have created com object for legacy apps (.net framework 3.5)

[ComVisible(true), Guid("...")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface MyComInterface
{
...
}


[ComVisible(true), Guid("...")]
[ProgId("...")]
[ClassInterface(ClassInterfaceType.None)]
public MyComObject: MyComInterface
{
 ... 
}

it installs fine and everything ok in registry (progid, clsid) I can create instance and use it from .net applications:

var t = Type.GetTypeFromProgID("myProgID");
var o = Activator.CreateInstance(t);

But vbs file

set o = CreateObject("myProgID")

argues with error: 0x80070002 (file not found)

What can be wrong here ?

1

1 Answers

2
votes

Try either:

  1. Installing the assembly containing the .Net COM object to the GAC.
  2. Or using the /codebase option of regasm to specify an absolute path to the assembly containing the .Net COM object.

You might also try copying the assembly to some location on the path or alongside the VBScript file, but I don't know if this will work or not.

You should also look into using Fusion logging to log assembly bind failures - this might give you some clues.