Is it possible to have a .net Remoting component, where each end uses a different version of the framework?

StackOverflow https://stackoverflow.com/questions/22516139

Frage

I'm working on a project that uses .Net Remoting to communicate with a Windows Service 'back end'. I really need to use Task<T> and async features in the back-end service, so I want to target .NET 4.5

However, due to factors outside of my control, the 'front end' component must use .net 3.5, which precludes use of all the async language features.

This is a bit of a headache.

In .net Remoting, both ends of the connection must share a reference to the remoted classes, so they are generally in a shared class library and that has been my approach. I was wondering, if I build two versions of the 'shared' class library, one targeting CLR2 and the other targeting CLR4, will the remoting pattern still work? Or does the remote end have to use the exact same object?

War es hilfreich?

Lösung

Yes. I have done it. We had a solution based on Remoting where each of our stores had a "listener" (service that's called by the client). There's a program in the corporate office's helpdesk that was a "sender" (client). Both initially written in .NET 1.1.

Eventually, we needed to do some updates, and the "sender" was upgraded to 2.0, and it worked just fine with the "listeners".

The key thing isn't the runtime version, it's the interface that's created. We just couldn't change the signature.

Andere Tipps

.net 4.0 may work in mixed mode and reference .net 2.0 assemblies so you can use the same asseembly. See: What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

What I did in the past is that I created a new project with the same source code plus some compile symbols to enable/disable features. Something like:

MySharedLibrary.csproj (4.0)

MySharedLibrary.3.5.csproj (3.5)

The remote server should not matter unless you are transferring objects that are not available or serializable in 3.5. Of course, you have to link/reference each side to the matching lib version.

Shared Class Library containing Remoting Service API must be compiled with Framewoer equal or lower than Client Program. We had a Remoting Client/Server aplicacion, and Server was updated to VS2013 and recompiled Shared library with .NET 4.5.2, the Client did not connect (compiled with .NET 4.0) until Shared Class library was compiled also with .NET 4.0 Regards.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top