I used to have a Visual Basic (VB6) COM DLL (let's call it "dllouter") which referenced another Visual Basic (VB6) COM DLL (let's call it "dllinner") with an interface "Interface". "dllouter" loaded "dllinner" in the following way:
Public objCom As dllinner.Interface
Set objCom = New dllinner.Interface
When "dllinner" version changed, without changes in "Interface", "dllouter" was able to load it without problems, without needing to recompile it.
After that, I replaced "dllinner" with a C# .NET assembly (VS2015) with [assembly: ComVisible(true)]
, and recompiling "dllouter" everything was fine and working.
But if I change [assembly: AssemblyVersion("1.0.0")]
to a newer version then Set objCom = New dllinner.Interface
fails. I need to recompile "dllouter" after updating the reference to the new "dllinner" to make it work.
I have noticed that comparing the .vbp files with references to Visual Basic "dllinner" and .NET "dllinner" there is a difference in the version listed after the GUID:
Reference=*\G{6B0651C5-5225-42A6-841F0322797E5018}#1.0#0#...
The value in bold is updated for the .NET assembly with the new assembly version (e.g. 2.0) while it remains unchanged for the Visual Basic DLL reference (always 1.0, no matter what the "dllinner" version is).
Thus I tried to add the property [assembly: TypeLibVersion(1,0)]
to assemblyinfo.cs and doing this "fixes" the reference in the .vbp meaning that the bold value is kept to 1.0 no matter what the AssemblyVersion is.
However, the problem is not solved: "dllouter" still fails to load "dllinner".
Is there a way to fix this problem, avoiding to recompile "dllouter" any time "dllinner" version changes?