“sgen.exe” exited with code 1

What? I moved my project to my development server and wanted to build for production and this error came up.

What is sgen.exe anyway? I found the answer on msdn: “The XML Serializer Generator creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.”

Hmm… I’m not sure my assembly will be XML serialized. Ever. Then what can I do about it?

Apparently there is a bug in the Visual Studio 2005 for some assemblies when building in release mode. The solution is to disable the generation of the serialization assembly:

  • Open the project properties
  • Go to the “build” tab
  • Find the “Generate serialization assembly” drop-down and choose “Off”

This solved the problem.

Fix to "sgen.exe" exited with code 1 problem

sgen.exe exited with code 1 fix: disable it :-)

One Response to ““sgen.exe” exited with code 1”

  1. sgen.exe exited with code 1 « Point Deep Says:

    [...] the “Generate serialization assembly” option in the Build tab of Project Properties see this blogpost and this [...]


Leave a Reply