Tuesday, February 22, 2011

XMLSerializer Error? XmlSerializerPreCompiler to the rescue

Recently came over 2 roadblocks for my code and worked it around:
1. Created an XML file with same child nodes to multiple parent nodes and tried XSD on .NET framework 1.1 and it burp, so i XSD it on framework 2.0 and created C# class, guess what it works when deployed on Win2K machine with Framework1.1 only!
2. Another major issue I ended spending many hours at:
So I compiled this assembly and deployed on Win 2K machine, the code didnt worka nd logged this error File or assembly name abcdef.dll, or one of its dependencies, was not found.
Thanks to Chris Sells's XmlSerializerPrecompiler tool, i was able to figure that SysNode class was created as a 2 dimension array SysNode[][] by .NET XSD compiler, all i had to do was manually edit it to SysNode[] and it worked! Here's a link to The XmlSerializerPreCompiler tools

No comments: