C# – Where to place the pre-generated serialization assembly


I am trying to speed up the start-up of my Click-Once (.net 2.0 in VS2008) app by shipping the pre-generated XML serialization assemblies.

So to test my scenario, I set VS2008 to break when an exception is thrown. Even though, the XML Serialization assemblies are there, there is still an exception, saying that it can't find or load the serialization assembly.

So I threw FileMon at the problem and it turns out that VS2008 looks for the serialization assemblies everywhere but where the assemblies actually are (e.g. bin folder).

Can someone clear up on why VS2008 is looking for the serialization assemblies in all the wrong places and whether I am barking up the wrong tree distributing them in the first place.

Best Solution

Hmmm... My sgen'ed XML serialization assemblies are in the same folder with their original dll.

E.g. for MyAssembly.dll I have MyAssembly.XmlSerializers.dll right next to it.

Also, make sure that both assemblies declare the same Assembly Version in their properties.