I have created a simple .NET COM-visible DLL 4.7.2 which I successfully exposed to COM via project settings as well as class tags like:
<ComVisible(True), Guid("4420535A-7EDA-4EB1-8CFE-963B527285C5")>
<ProgId("EDMSApiCOMWrapper.EDMSCOMClient")>
and a corresponding tabg on the class interface:
<ComVisible(True), Guid("3309A516-6622-4390-B0E4-C6004DAAFEC4")>
<InterfaceType(ComInterfaceType.InterfaceIsDual)>
I signed it with an .snk file I generated using the .NET tool and targeted x86 for build since I will need to use this app on a Windows 7 32-bit machine with VB6.
It built in VS 2019 no problem and generated the Type Lib (.tlb).
I put a simple public method to add numbers in the one public class.
I moved my build .dll and .tlb to my Win7 32-bit dev machine where I will need to use it in VB6.
I ran:
gacutil /i EDMSApiCOMWrapper.dll
and
regasm /codebase EDMSApiCOMWrapper.dll
and that worked fine.
I then added a reference to my EDMSApiCOMWrapper.tlb in my VB6 project and that worked then I was able to instantiate the class:
Dim myObj As EDMSApiCOMWrapper.EDMSCOMClient
Set myObj = New EDMSApiCOMWrapper.EDMSCOMClient
Dim r As Int
r = myObj.MyAddMethod(5,4)
And r
was 9 as expected. Huzzah!
Ok, so that was a simple test to make sure I had the referencing steps down. So now I added some real code to my method, which makes use of other .NET dll's in its imports and uses those classes. Some of the dll's are ones we control, some are third party (no control).
I rebuilt and re-gac's and regasm'd my COM wrapper dll and made sure all the dll's it references are in the same directory with my COM dll.
My COM wrapper only references one library (AlfrescoAPI) which was built by us using .NET standard 2.0, and it has dependencies on several other 3rd party .NET libraries.
When I try to run and call a method now in VB6 I get this error message:
Now, I made sure that AlfrescoAPI (which we control) was strongly named (signed using an .snk file... perhaps I need to do more on that front?).
So in summary:
I am able to build a COM-visible library in .NET 4.7.2, register it on my Win 7 32-bit machine and reference and call methods in VB6 on it, but when modify my COM visible .NET 4.7.2 to reference another .NET library we built (.NET standard 2.0) and that library references other third party .NET dll's I get the problems above.
I am wondering if this is even possible to go further and if so, what steps must I do to get the referenced dll's to work with my 32-bit VB6 program Win 7 project.