title: How to target .net 4.5 with CSharpCodeProvider?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9591584/using-csharpcodeprovider-with-net-4-5-beta">Using CSharpCodeProvider with .net 4.5 beta</a>  </p>
  </blockquote>
  
  
  
  <p>For .net 3.5 I pass v3.5 to CSharpCodeProvider, when I pass v4.5 to CSharpCodeProvider in a v4.5 app I get <code>InvalidOperationException</code> "Compiler executable file csc.exe cannot be found."</p>
  
  <p>Anyone any idea what's going on here, what am I doing wrong?</p>
  
  <p>Code to reproduce . . .</p>
  
  <pre><code>using Microsoft.CSharp;
  using System;
  using System.CodeDom.Compiler;
  using System.Collections.Generic;
  
  namespace Console1
  {
      class Program
      {
          static void Main(string[] args)
          {
              var options = new Dictionary&lt;string, string&gt;{{"CompilerVersion", "v4.5"}};
              var cs = new CSharpCodeProvider(options);
  
              var compilerParams = new CompilerParameters();
  
              var r = cs.CompileAssemblyFromSource(compilerParams , "namespace ns { class program { public static Main(string[] args) { System.Console.WriteLine(\"Hello world\"); } } }");
          }
      }
  }
  </code></pre>