Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have some data-classes in an assembly (.exe), that should be moved to another assembly (dll).
The objects are (de)serialized with BinaryFormatter.

As long as the classes are located in the original assembly everything works fine but when they are moved to the DLL deserializing of the old data fails.
My thought was that the objects cannot be found since the data-files contain links to the original assembly.

I implemented a custom serialization-binder-class that changes the assembly-name to the new assembly and replaces the original assembly-name in typename to the new assembly name.

The serialization still fails, probably because some types cannot be found although the names were changed. Unfortunately there are some generic dictionaries and lists inside these objects.

Is there a way to deserialize the "old files" to "new objects" without losing data?

Thanks for help!

regards

J.
Posted
Updated 27-Sep-10 21:31pm
v2
Comments
Dalek Dave 28-Sep-10 3:31am    
Edited for Grammar, Spelling and Readability.

Have you tried to use a publisher policy[^] to force any applications to use your new assembly?
 
Share this answer
 
Hmmm... I haven't tried this yet. Does this work for assemblies that are distributed via e.g. MSI? Or does it work only on the machine i use this policy?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900