My project uses a typed dataset to handle its data. Some columns in a few datatables use types from a custom assembly. When a dataset is serialized, it saves the column and datatype like so
<xs:element name="Mode" msdata:DataType="MyAssembly.Adapters.Mode, MyAssembly, Version=6.3.1.0, Culture=neutral, PublicKeyToken=dab9b4e6f12a95d2" type="xs:anyType" minOccurs="0" />
Now when the assembly, MyAssembly, is updated this full name no longer matches so when the program is rerun and tries to deserialize the xml, an exception is thrown saying that it cant find the assembly for version 6.3.1.0.
I tried removing the full name, like below, and just leaving the type, but that is not legal.
<xs:element name="Mode" msdata:DataType="MyAssembly.Adapters.Mode" type="xs:anyType" minOccurs="0" />
Does anyone know how to deserialize while using the updated assembly's types?
I had to revisit this years later and I wasn't happy with this solution and was reminded that this looked just like the problem solved by binding redirection.
Add the following to the configuration file for the main app project. It should output app.exe.config.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Assembly" publicKeyToken="token" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
If it is NUnit, then add a Application Configuration file to the NUnit project. It should output Assembly.dll.config
Now rewriting the XML is not necessary.