How can I call .NET 2.0 components from .NET 1.1?
Is this possible?
As a workaround, I tried to make a .NET 2.0 component COMVisible, and add it as COM reference from a VS2003 project, but doesn't works.
Thanks,
Ricardo Stuven.
[199 byte] By [
rstuven] at [2007-12-16]
But is there no workaround either? I don't look necessarily for a transparent solution...
Anyway, this is so sad. I think that, in the same way there is interop between COM and .NET (forward compatibility, in a sense), should exist at least limited interop between different versions of the same framework.
Regards,
Ricardo Stuven.
There is interop, it's just backwards.. i.e. you can call a .net 1.1 component from 2.0 but not the other way around.
I can't see why COM interop wouldn't work though. Did you sign the assembly, enabled COM interop then install the asm into the GAC? You should then find it in the references list for VS. Not the best option performance wise I suppose
Martin,
The message VS2003 raises is:
"A reference to 'NET20ClassLibrary' could not be added. Converting the type library to a .NET assembly failed. Type library NET20ClassLibrary was exported from a CLR assembly and can not be re-imported as a CLR assembly."
So I tried to make another COM wrapper using VB6 (indeed interop performance is not a problem in this particular case), say VB6ClassLibrary.
If I call it from VB6 it works, and I can add it as reference from VS2003 even.
However running the .NET 1.1 test app, I get this exception:
"System.BadImageFormatException: The format of the file 'NET20ClassLibrary' is invalid."
I suppose that, calling it from VB6, the wrapper is using the correct CLR version (2.0) to load the assembly, but from the .NET 1.1 test app, the wrapper use the latter, wrong CLR version (1.1) to load NET20ClassLibrary...
Vikram,
My initial aim was to achieve in-process forward compatible interop, but at this point I'm giving up so I will explore out-process alternatives as you suggest.
However, I think a webservice is cumbersome from an administrative point of view.
By 'sockets' do you mean .NET remoting or a more low-level approach? Please, could you give me a hint of how to implement something like that (considering the different framework versions, of course)?
Thanks,
Ricardo Stuven.