title: Roslyn - CodeDom: HowTo dynamically compile Code to Universal-Windows-Library
body: <p>I am generating a .NET Dll dynamically containing wrapper classes for a WPF Project. I am doing it with the System.CodeDom.Compiler.CodeDomProvider class.</p>
  
  <p>Now I have to create a wrapper class for a Universal-Windows-Dll.
  Since the <code>System.CodeDom.Compiler.CodeDomProvider</code> class still uses the old .NET Compiler I had to Switch to the new Roslyn Compiler (by adding the Nuget Package <code>Microsoft.CodeDom.Providers.DotNetCompilerPlatform</code>).
  Then I replaced the instantiation of the code-dom-Provider with the new <code>CSharpCodeProvider</code>.</p>
  
  <pre><code>new Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider();
  </code></pre>
  
  <p>The Code compiles fine but I found no way to set the TargetFramework / CompilerVersion.
  The old <code>CodeDomProvider</code> had the <code>CompilerOptions</code> where I was able to specify the <code>CompilerVersion</code> ect. But the new Roslyn does not have this Option (or I was to stupid to find it).</p>
  
  <p>The result is that it compiles the DLL as a normal .NET 4.x Dll. But I Need a Universal-Windows Dll since it is used in a Universal-Project.</p>
  
  <p>Browsing the Internet I found many different ways to use the Roslyn Compiler. Most of them seem to be from old Beta-Versions of the Compiler, therefore none of them works. 
  The <code>Roslyn.Compilers</code> Namespace (which was used in most examples) seems to be the Namespace from the betas.</p>
  
  <p>Does someone know how to use the roslyn Compiler properly?
  I don't want to modify the Compiler. I simply want to generate a DLL dynamically by compiling it from SourceCode, but I have to specify the Platform Target.</p>