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]
# 1
Hi,

This is not possible. Microsoft has stated that there is no forward compatibility with .NET Framework v2.0. Assemblies built in v2.0 will simply not work with v1.1.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
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.
rstuven at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
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
MartinCarolan at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4
Hi,

I guess you have to go for something like wrapping the functionality as webservices or communicate over sockets.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 5
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.

rstuven at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 6
From the sounds of that error you added the dll as a .net component not a COM component... you need to add it as a COM component to use COM interop
MartinCarolan at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 7
I added it as a COM reference. Try yourself Smile
Regards,
Ricardo Stuven.
rstuven at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 8
Hi,

You have to go for sockets at a low-level.
http://www.developerfusion.com/show/3918/

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified