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:
- I have simple one method dummy class with no attributes.
- The class is in a class library which has "Make assembly COM-visible" ticked in Visual Studio.
- The class library is signed.
- 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.
Edit: Resolved. I don't have a full explanation, but eventually I found out that it was caused by using:
%windir%\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe
and not the 64-bit version:
%windir%\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe
I compared the generated registry keys of the two RegAsm's, and they were the same. So guessing that they generate something else than the registry keys.