views:

299

answers:

1

I have an assembly which I have managed to make visible to VB6 and it works, but having a problem accomplishing the same thing with VB5.

For VB6, I have built the assembly, made it COM-visible, registered it as a COM object etc., and the assembly shows in VB6's References list, and allows me to use it successfully. The Object Browser also shows the method in the assy. I copied the assembly and its TLB to a virtual workstation used for VB5 development, and ran Regasm, apparently successfully:

C:\>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
\regasm arserviceinterface.dll /tlb:arserviceinterface.tlb
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.3053
Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

Assembly exported to 'C:\Projects\AR\3rd Party\ARService\arserviceinterface.tlb'
, and the type library was registered successfully

Note that the virtual W/S is Win2k and does not have .NET Fx 3.5 on it, just 2.0.

The assembly shows up in the References that can be selected in VB5, but the method of the assembly doesn't show up in the Object Browser, and it is generally unusable. Either there is a step to do that I haven't done, or VB5 doesn't know how to use such a COM object. Note that the VB5 setup is on a virtual workstation, not the same workstation that VB6 is installed on.

Any ideas? One thing that occurred to me is that I might need to generate and use a strong name on the workstation in question, but...

+2  A: 
  1. Make sure your assembly is not build against and using features from .Net 3.5
  2. Copy the OLE/COM Object Viewer tool (you can get it from a machine with the Windows SDK installed). Run it, go to View All Objects, scroll down the list to your object and right click on it to create an instance.
    2.1 If OLE/COM Object Viewer can't create an instance, the problem is in how the object is registered on the machine, or how .Net is installed.
    2.2 If OLE/COM Object Viewer can create an instance, then the problem is in how VB5 consumes.
  3. I can't remember if VB5 actually supports early-binding (IUnknown-based objects) or if supports only late-binding (IDispatch). I have the sneaking suspicion that VB5 only supported dispinterfaces, and it was VB5.5 that introduced support for IUnknown. So that could be your problem.
Franci Penov