title: CompilerParameters.ReferencedAssemblies -- Add reference to System.Web.UI.WebControls
body: <p>I am compiling classes at run-time using the <code>CodeDomProvider</code> class. This works fine for classes only using the <code>System</code> namespace:</p>
  
  <pre><code>using System;
  
  public class Test
  {
      public String HelloWorld()
      {
          return "Hello World!";
      }
  }
  </code></pre>
  
  <p>If I try to compile a class using <code>System.Web.UI.WebControls</code> though, I get this error:</p>
  
  <blockquote>
    <p>{error CS0006: Metadata file 'System.Web.UI.WebControls' could not be found}
    System.CodeDom.Compiler.CompilerError</p>
  </blockquote>
  
  <p>Here's a snippet of my code:</p>
  
  <pre><code>var cp = new CompilerParameters();
  
  cp.ReferencedAssemblies.Add("System.Web.UI.WebControls");
  </code></pre>
  
  <p>How do I reference the <code>System.Web.UI.WebControls</code> namespace?</p>