How Does a COM Program Locate a .NET DLL Registered for COM Interop?

Posted by Eric J. on Stack Overflow See other posts from Stack Overflow or by Eric J.
Published on 2010-05-19T17:47:50Z Indexed on 2010/05/19 17:50 UTC
Read the original article Hit count: 404

Filed under:
|
|

One customer wants to consume our .NET DLLs from VB6. They are designed to support reverse interop and all works fine... except: There are two separate VB6 programs in two different directories. It seems it's necessary to do one of:

  1. Copy the .NET DLL into both directories, or
  2. Install the .NET DLL in the GAC

This is the customer's observation and also supported by the RegAsm documentation:

After registering an assembly using Regasm.exe, you can install it in the global assembly cache so that it can be activated from any COM client. If the assembly is only going to be activated by a single application, you can place it in that application's directory.

I'm confused on this point.

First point of confusion:

As far as I understand, the COM runtime locates the DLL using the Prog ID / Class ID. When I look in the registry at the Class ID entry, I see the full path to the .NET DLL in the CodeBase key. Why is it that a COM program using the Prog ID / Class ID doesn't locate the .NET DLL using the CodeBase?

Second point of confusion:

The GAC is specific to .NET. How is it involved in resolving COM references?

© Stack Overflow or respective owner

Related posts about com-interop

Related posts about regasm