问题
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)?
回答1:
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.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/10831854/what-is-the-benefit-of-turning-generate-serialization-assemblies-off