Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'MyAssembly.XmlSerializers [duplicate]

I took a memory dump of IIS and while analyzing i found the error that said 'Could not load file or assembly MyAssemblyName.XmlSerializers'. In my code i am using XmlSerializer class to serialize and deserialize xml contents from xml file to custom object. When the project gets build it only creates MyAssembly.dll and MyAssembly.pdb file but not the MyAssembly.XmlSerializers.dll. Does anyone know how to enable my project to create xmlserializers.dll file?

Note: In project build tab, 'Generate serialization assembly is set to Auto.

Thanks.

like image 644
sanjeev40084 Avatar asked Jul 19 '13 21:07

sanjeev40084


People also ask

What is XmlSerializers DLL?

In . NET, XmlSerializers. dll is for serializing/deserializing the . NET classes. Its more for performance boost.

What is a serialization assembly?

The serialization assembly improves the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.


2 Answers

There's an answer already here. Apparently this is "expected behaviour" that MS isn't going to fix.

The first comment has a workaround:

One of the possible ways to get rid of this problem is check "Just my code" option in Tools -> Options -> Debugging -> General options

like image 124
Bok McDonagh Avatar answered Sep 19 '22 08:09

Bok McDonagh


You can also generate this assembly using Sgen.exe

For me it's located in: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools

1. open cmd command 2. cd yourProjectPath 3. sgen Project.dll 

The following command creates an assembly named Project.XmlSerializers.dll for serializing all the types contained in the assembly named Project.dll.

like image 27
LIDEN Avatar answered Sep 21 '22 08:09

LIDEN