Home All Groups Group Topic Archive Search About

Preventing generation of XML serialization assemblies at runtime (also for dlls)

Author
11 Apr 2007 5:50 AM
Andreas Schuler
Hi all,

Here's my basic problem: In my application I am using web services as
well as other classes that can get serialized using the XML
serializer. I have a simple installer project so I can deploy my
application on other people's machines. What I have found is that the
XML serialization assembly generation, which happens at runtime, is
contributing quite substantially to prolonged startup times.
I should also mention that part of my application is an activex
control, which can be displayed in IE.

So I am looking for a solution, where this generation of assemblies at
runtime is no longer necessary. I am aware of the sgen tool and the
ability of the VS2005 projects to generate the XML serialization
assemblies. The issue is that when I am running my activex control,
this serialization assembly, which resides in the same folder as the
control's dll, does not get loaded. I believe this is due to the fact
that .NET only checks in the executable's path (which would be IE in
my case).

I have also experimented with the IXmlSerializable interface for one
of the classes I am controlling (i.e. not web service related). I
would have thought that for this class .NET would no longer have to
generate such an external serialization assembly; unfortunately I was
wrong. I could even step through my code and could show that the
framework would use my implementation of the read and write methods. I
have also tried to set "Generate serialization assembly" to off to no
avail.



How can I get this extra serialization assembly get picked up by my
activex control? Would it work if I installed both the assembly
containing the web services as well as its serialization assembly in
the GAC?

Isn't there a way that the compiler could generate those reader/
writers in the same assembly that contains the classes to be
serialized?

Can anyone explain to me why .NET would still generate an XML
serialization assembly if my all class(es) within the library compiled
implement the IXmlSerializable interface? Do I have to implement
ISerializable instead?

Is there a compiler switch or attribute I could use to force the
complete disabling of serialization assembly generation?

What do I have to implement to make automatic generation of
serialization assemblies go away?


Any help greatly appreciated,

Andreas

AddThis Social Bookmark Button