I’ve got a .net 2.0 class library that uses .net remoting to communicate with a .net 2.0 server application.
I’m now creating a WPF version of the client and included the .net 2.0 communication dll.
The remoting no longer works (Exception Could not load file or assembly ‘System.Data, Version=4.0.0.0,)
the line that fails is passing a DataTable as a parameter to a remote method.
The problem is if you use .GetType().Assembly it really does show that it’s using the .net 4.0 System.Data assembly which the server obviously doesn’t know about.
is there a way I can force the library to use .net 2.0 libraries for serialization?
This kinda depends on what type of configuration you’re targeting, even if you run 2.0 and 4.0 in a mixed fashion this should be taken care by the run-time for you.
There seem to be a lot of components involved here, are you sure they are built using the correct frameworks?
If you build a WCF client on one machine and targets a different framework than the one installed on the machine that runs it it could lead to problems.
I’d like to know some more about your setup, specifically what projects you have and what “profile” these projects targets.
Meanwhile, you could try hooking the
AppDomain.CurrentDomain.AssemblyResolveevent and try locating the assembly yourself, it can work but it can also help to identify where in your code this problem occurs.