title: CSharpCodeProvider seems to be stuck at .NET 2.0, how do I get new features?
body: <p>I have the following, fairly standard code as a wrapper around <code>CSharpCodeProvider</code>. This class works very well, and performs just fine, etc, etc. But, despite the fact that my application is built against .NET 3.5 and is referencing v3.5 assemblies when doing this compilation, I still don't get access to any of the extra nice C# 3.5 syntax like lambda's or auto-properties. Is there some way to get this working? </p>
  
  <p>I was under the impression that this class just wrapped around <code>csc.exe</code>, an idea that would seem to be confirmed by my firewall (my application tries to access <code>csc.exe</code>). Perhaps I just need to set <code>options.CompilerOptions</code> to something?</p>
  
  <pre><code>protected virtual void Compile()
  {
      Microsoft.CSharp.CSharpCodeProvider csProvider = new Microsoft.CSharp.CSharpCodeProvider();
  
      CompilerParameters options = new CompilerParameters();
      options.GenerateExecutable = false;
      options.GenerateInMemory = true;
      options.IncludeDebugInformation = true;
  
      foreach (string s in this.ReferencedAssemblies)
      {
          options.ReferencedAssemblies.Add(s);
      }
  
      CompilerResults result;
      string source = this.CodeTemplate;
  
      // [snip] Do some manipulation to fill in the template with values.
  
      result = csProvider.CompileAssemblyFromSource(options, source);
  
      this.HasErrors = result.Errors.HasErrors;
      this.Errors = new CompilerError[result.Errors.Count];
      result.Errors.CopyTo(Errors, 0);
  
      if (HasErrors &amp;&amp; ThrowOnErrors)
          throw new InvalidProgramException("The code currently stored in the " + this.GetType() + " cannot be compiled.");
      else if (HasErrors)
          return;
      this.CompiledAssembly = result.CompiledAssembly;
  }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I have references to <code>mscorlib</code>, <code>System.Core</code>, <code>System.Text</code> and one of my own assemblies at the moment.</p>