title: Generating an Xml Serialization assembly as part of my build
body: <p>This code produces a FileNotFoundException, but ultimately runs without issue:</p>
  
  <pre><code>void ReadXml()
  {
      XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
      //...
  }
  </code></pre>
  
  <p>Here is the exception:</p>
  
  <hr>
  
  <p>A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll</p>
  
  <p>Additional information: Could not load file or assembly 'MyAssembly.XmlSerializers, Version=1.4.3190.15950, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.</p>
  
  <hr>
  
  <p><strong>It appears that the framework automatically generates the serialization assembly if it isn't found.</strong>   I can generate it manually using sgen.exe, which alleviates the exception.  </p>
  
  <p><strong>How do I get visual studio to generate the XML Serialization assembly automatically?</strong></p>
  
  <hr>
  
  <p><strong>Update: The Generate Serialization Assembly: On setting doesn't appear to do anything.</strong></p>