16

The Generate Serialization Assemblies option in Visual Studio creates a MyAssembly.XmlSerializers.dll when my project is built. This question (https://stackoverflow.com/questions/934411/what-is-myassembly-xmlserializers-dll-generated-for) indicates a reason why it's there in the first place, and some of the answers provide ways to turn it off, but my question is why would you choose to turn it off? Does having it turned on cause problems in certain situations (and, if so, what are those situations)?

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
m-smith
  • 2,943
  • 4
  • 25
  • 39
  • 2
    Erm, your project will build faster. It certainly won't run faster. – Hans Passant May 31 '12 at 12:30
  • 2
    @HansPassant - to clarify "won't run faster" - the serialization assemblies are being built when app touches them - so it will affect start up times, not overall performance. – Ondrej Svejdar Dec 12 '13 at 10:45

4 Answers4

9

Only problems you might be facing are with build tools - such as msbuild, because if you use sgen from x32 SDK on assembly that is explicitly x64 it will raise a build-time error (you can easily overcome this by setting correct SGenToolPath path to msbuild or target MSIL instead). IMHO it is better to deal with build time issues and have quicker startup time.

Ondrej Svejdar
  • 21,349
  • 5
  • 54
  • 89
7

Turning it off stopped the build and run time errors I was getting as a result of upgrading my application to v4.0. I was getting SGEN errors after trying many of the solutions posted online. Doing this solved that issue.

Marcel
  • 71
  • 1
  • 2
2

I had to turn it off when I needed to Sign a "ClickOnce" application. I could not successfully deploy it with the Generate Serialization Assemblies on. The MyAssembly.XmlSerializers.dll had reference in the manifest file, but it is was not part of the deployment package.

Druid
  • 6,423
  • 4
  • 41
  • 56
Frank Socha
  • 147
  • 2
  • 12
-2

Right click your project and select Edit. Next add this inside "Release" property group

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
</PropertyGroup>
Hrvoje Matic
  • 1,207
  • 15
  • 12