title: How to correctly save a WF4 ActivityBuilder
body: <p>I am currently saving my .NET FX 4.0.1 StateMachine activity like this:</p>
  
  <pre><code>var sb = new StringBuilder();
  var xamlWriter = ActivityXamlServices.CreateBuilderWriter(
                       new XamlXmlWriter(new StringWriter(sb),
                       new XamlSchemaContext()));
  XamlServices.Save(xamlWriter, activityBuilder);
  
  return sb.ToString();
  </code></pre>
  
  <p>This works fine and the generated XAML looks good. Unfortunately, it is invalid. I can read it back in using <code>ActivityXamlServices.Load</code> but when I execute it, it says that it doesn't know the properties defined in the workflow. Opening it in the Visual Studio designer yields the same errors:</p>
  
  <blockquote>
    <p>Compiler error(s) encountered processing expression "ActiveCall". "ActiveCall" is not declared. It may be inaccessible due to its protection level.</p>
  </blockquote>
  
  <p>Through comparing the original XAML with the XAML produced by my code, I found out how to fix this problem. I have to have this tag before the <code>StateMachine</code> tag:</p>
  
  <pre><code>&lt;mva:VisualBasic.Settings&gt;
      Assembly references and imported namespaces for internal implementation
  &lt;/mva:VisualBasic.Settings&gt;
  </code></pre>
  
  <p>By the way:<br>
  The text inside the tag must be exactly like this, otherwise there will be an error when opening the WF in VS:</p>
  
  <blockquote>
    <p>Failed to create a 'Settings' from the text 'FooBar'</p>
  </blockquote>
  
  <p><strong>Question:</strong><br>
  What do I have to change in my code to have this tag in the generated XAML?</p>