views:

41

answers:

2

I've added types to my .NET classes that I'm using for COM interop. To get it to work with my VB6 application, I unregistered the DLL and re-registered it (using regasm). I then uninstalled and reinstalled it to the GAC (using gacutil).

The types are showing up in the VB6 object explorer, but when I run the application in the VB6 IDE, it breaks on the line that instantiates the new types with the error: Automation Errror - The System cannot find the file specified.

I thought this odd since I had already updated the GAC, so I uninstalled the dll from the GAC and got the exact same error, which seems to indicate that the older version of the dll is already in memory and needs to be "reloaded" so that the newer DLL is in memory. Is this possible, and if so, what do I need to do?

+1  A: 

I suspect that regasm.exe is adding COM entries for your objects and pointing them to teh location of the assembly before it was GAC'd. Normally that shouldn't make a difference as the GAC will win in all cases. But there could be a difference for COM interop.

Try digging through the registry and see where the COM entries are pointing to for your COM interfaces and make sure your assembly exists at that location.

JaredPar
@Jared I'm not sure that I'm looking in the right spot in the registry, but when I look in the corresponding key in `CLSID`, there's not a specific DLL listed, but rather a key called `InprocServer32` with values for `(Default)`,`Assembly`, `Class`, `RuntimeVersion` (which is v4.0.30319), and `ThreadingModel`. Since there's no DLL specified (as there would have been if I had used the `/codebase` option with `regasm`), I assume it's trying to use the file from teh GAC, but for it doesn't seem like the file from the GAC is always loaded into memory when it changes, but I'm not sure.
Ben McCormack
A: 

Try saving your VB6 project, closing the IDE and re-opening your project. That worked for me in this situation.

Ben McCormack