title: Add additional References when compliling code at runtime
body: <p>I found this program ( <a href="http://support.microsoft.com/kb/304655" rel="nofollow">http://support.microsoft.com/kb/304655</a> ) where i compile the code during runtime, It works for code that uses the reference,</p>
  
  <pre><code>using System;
  </code></pre>
  
  <p>Following is the the code for the program that compiles code during runtime,</p>
  
  <pre><code>        CSharpCodeProvider codeProvider = new CSharpCodeProvider();
          ICodeCompiler icc = codeProvider.CreateCompiler();
  
          string Output = "Out.exe";
          Button ButtonObject = (Button)sender;
  
          textBox2.Text = "";
          System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
          //Make sure we generate an EXE, not a DLL
          parameters.GenerateExecutable = true;
          parameters.OutputAssembly = Output;
          CompilerResults results = icc.CompileAssemblyFromSource(parameters, textBox1.Text);
  
          if (results.Errors.Count &gt; 0)
          {
              textBox2.ForeColor = Color.Red;
              foreach (CompilerError CompErr in results.Errors)
              {
                  textBox2.Text = textBox2.Text +
                              "Line number " + CompErr.Line +
                              ", Error Number: " + CompErr.ErrorNumber +
                              ", '" + CompErr.ErrorText + ";" +
                              Environment.NewLine + Environment.NewLine;
              }
          }
          else
          {
              //Successful Compile
              textBox2.ForeColor = Color.Blue;
              textBox2.Text = "Success!";
              //If we clicked run then launch our EXE
              if (ButtonObject.Text == "Run") Process.Start(Output);
          }
  </code></pre>
  
  <p>And Following is the code i need to compile at runtime,</p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Net;
      using System.Text.RegularExpressions;
      using Newtonsoft.Json.Linq;
  
      namespace Tsubame
      {
          class Program
          {
              static void Main(string[] args)
              {
                  HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"url");
  
                  // Create Client
                  WebClient client = new WebClient();
  
                  // Assign Credentials
                  client.Credentials = new NetworkCredential("user", "pass");
  
                  //Grab Data
                  var data = client.DownloadString(@"url");
  
                  JObject o = JObject.Parse(data);
                  string getFristRow = Convert.ToString(o["Body"][0]["RowId"]);
  
                  string encaplulateStart = "\\\"";
                  string encaplulateEnd = "\\\":";
  
                  List&lt;string&gt; _matches = new List&lt;string&gt;();
                  _matches = Regex.Matches(getFristRow, @"(?&lt;=" + encaplulateStart + ").*(?=" + encaplulateEnd + ")")
                                      .Cast&lt;Match&gt;()
                                      .Select(m =&gt; m.Value)
                                      .ToList();
  
                  foreach (string head in _matches)
                  {
                      Console.WriteLine(head);
  
                  }
                  Console.ReadLine();
              }
          }
      }
  </code></pre>
  
  <p>But when I input this gives the error code,</p>
  
  <pre><code>    Error Number: CS0234
  </code></pre>
  
  <p>For the references other than System. May I please know how to add additional references during runtime so that it can compile sucessfully :) Thank you very much :)</p>