title: Razor fails to delete dynamic template dll files and trashes filesystem
body: <p>After upgrading from Razor templating engine 3.3.0 to 3.6.1 I've run into issues with precompiled templates - what happens is that even the trivial sample given on their page:</p>
  
  <pre><code>using System;
  using RazorEngine;
  using RazorEngine.Templating;
  using System.Diagnostics;
  
  namespace RazorTest
  {
      class Program
      {
          static void Main(string[] args)
          {
              string template = "Hello @Model.Name, welcome to RazorEngine!";
              Debug.WriteLine("Before Compile()");
              var result = Engine.Razor.RunCompile(template, "templateKey", null, new { Name = "World" });
              Debug.WriteLine("After Compile()");
           }
      }
  }
  </code></pre>
  
  <p>Throws <code>System.UnauthorizedAccessException</code> on exit when trying to delete the generated dll files. The debug output shows everything quite nicely:</p>
  
  <pre><code>Before Compile()
  'RazorTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\user\Documents\Visual Studio 2010\Projects\RazorTest\RazorTest\bin\Debug\System.Web.Razor.dll'
  'RazorTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\user\AppData\Local\Temp\RazorEngine_zzxr14ak.ysb\CompiledRazorTemplates.Dynamic.RazorEngine_dc2066212315402592a6d2d155476c19.dll'
  'RazorTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
  'RazorTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.dll'
  A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
  A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
  After Compile()
  The thread 'vshost.RunParkingWindow' (0x3064) has exited with code 0 (0x0).
  The thread '&lt;No Name&gt;' (0x2df0) has exited with code 0 (0x0).
  A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
  A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
  A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
  The program '[26908] RazorTest.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
  </code></pre>
  
  <p>The dll file is loaded by the application during compilation so it makes sense that if some kind of unloading is not done Razor will not be able to delete it, and the files are left on the disk. </p>
  
  <p>What else seems weird that even though the type of the model is given Razor considers the template to be dynamic (at least judging from the dll name).</p>
  
  <p>Has anyone more experienced with Razor encountered this or can provide some hints on how to overcome this issue?</p>