title: Regex.CompileToAssembly how to set .dll file location
body: <p>I'm experimenting with precompile regexes in an .fsx script. But I can't figure out how to specify the .dll file location for the generated assembly. I've tried setting properties such as <code>CodeBase</code> on the <code>AssemblyName</code> instance used by <code>Regex.CompileToAssembly</code> but to no avail. Here's what I have:</p>
  
  <pre><code>open System.Text.RegularExpressions
  
  let rcis = [|
      new RegexCompilationInfo(
          @"^NumericLiteral([QRZING])$",
          RegexOptions.None,
          "NumericLiteral",
          "Swensen.Unquote.Regex",
          true
      );
  |]
  
  let an = new System.Reflection.AssemblyName("Unquote.Regex");
  an.CodeBase &lt;- __SOURCE_DIRECTORY__  + "\\" + "Unquote.Regex.dll"
  Regex.CompileToAssembly(rcis, an)
  </code></pre>
  
  <p>I'm executing this in FSI and when I evaluate <code>an</code> I see:</p>
  
  <pre><code>&gt; an;;
  val it : System.Reflection.AssemblyName =
    Unquote.Regex
      {CodeBase = "C:\Users\Stephen\Documents\Visual Studio 2010\Projects\Unquote\code\Unquote\Unquote.Regex.dll";
       CultureInfo = null;
       EscapedCodeBase = "C:%5CUsers%5CStephen%5CDocuments%5CVisual%20Studio%202010%5CProjects%5CUnquote%5Ccode%5CUnquote%5CUnquote.Regex.dll";
       Flags = None;
       FullName = "Unquote.Regex";
       HashAlgorithm = None;
       KeyPair = null;
       Name = "Unquote.Regex";
       ProcessorArchitecture = None;
       Version = null;
       VersionCompatibility = SameMachine;}
  </code></pre>
  
  <p>But, again, I don't see <em>C:\Users\Stephen\Documents\Visual Studio 2010\Projects\Unquote\code\Unquote\Unquote.Regex.dll</em> like I want. If I search my C-drive for <em>Unquote.Regex.dll</em>, I do find it in some temp AppData folder.</p>
  
  <p>So, how can I correctly specify the .dll file location for an assembly generated by <code>Regex.CompileToAssembly</code>?</p>