views:

3893

answers:

5

I am working on a project which generates an assembly. I just noticed that an additional assembly *.XmlSerializers.dll is being generated. Why this file is auto generated and what it is used for?

+2  A: 

I think this is the JIT (Just in time) compilation of XML serialisers for performance reasons.

You get the same thing with RegEx instances using the RegexOptions.Compiled option turned on.

I'm no .NET CLR expert, sorry for lack of precise technical detail.

Alan Christensen
+2  A: 

*.XmlSerializers.dll are generated using the Sgen.exe [XML Serializer Generator Tool]

See Sgen.exe on MSDN

Typically the Sgen.exe is used in Post Build events of Projects. See if your project has a post build event which generates the *.XmlSerializers.dll

AB Kolan
A: 

Why don't you open up your assemblies in Reflector and see if you can find out what uses it?

Dominic Cronin
+8  A: 

In .Net implementation, the XmlSerializer generates a temporary assembly for serializing/deserializing your classes (for performance reasons). It can either be generated on the fly (but it takes time every execution), or it can be pregenerated during compilation and saved in this assembly you are asking about. You can change this behaviour in project options.

Grzenio
If it's generated when the project setting is Auto, does that mean it's needed? what happens if you don't deploy the X.XMLSerializers.dll with the application, will it be generated on the fly?
Rory
+2  A: 

FYI. The exact steps to stop the XmlSerializers.dll from being auto-generated are:

  1. In VS, right-click your project file and select "Properties"
  2. Click the "Build" tab
  3. Change the "Generate serialization assembly" dropdown from "Auto" to "Off"
  4. Rebuild and it will be gone
jontsnz
Yeah but the question was **why** it is generated!
Hemant