I am generating an xmlserializer dll for my service. It is a big webservice - the build takes about 2 minutes.
To reduce the build time, I separated out the build of the xmlserializer into a separate Makefile project - given that the interface isn't changing, I thought I could compile it once, and that would be it.
But, what I have found, if I recompile the service, the xmlserializer is not longer used and the serializer code is being generated at run time.
Has anyone seen this? Is there a work around? What may be causing the xmlserializer to no longer match service assembly?
Thanks.
Update:
Ok, I've found half the answer...
Describes the XmlSerializerVersionAttribute (which is in the generated .cs code).
The document says...
If the infrastructure finds an assembly with a matching name, the assembly is loaded and the infrastructure checks XmlSerializerVersionAttribute for a match between the found assembly's version and the current version of the parent assembly. If the version does not match, the found assembly is not used. Instead, a temporary assembly is generated for the serialization.
Looking in the .Net Framework source code shows that the ParentAssemblyId is actually the module version id, ie
Assembly.GetExecutingAssembly().GetModules()[0].ModuleVersionId
However, if I load the xmlserializer assembly manually, and change the ParentAssemblyId field on the attribute, it still doesn't work - I'm guessing the framework loads its own copy of the serializer assembly.