title: Strongly typed Razor views in dynamically loaded assembly don't compile at runtime
body: <p>I have a MVC3 Area in an assembly that is <strong>dynamically loaded</strong> with MEF.<br>
  If I use the Webforms view engine with strongly typed views, everything works fine.<br>
  If I use the Razor view engine with a <code>dynamic</code> model, it works fine too.</p>
  
  <p>But if I use a <strong>strongly typed Razor view</strong>, the view compilation fail at runtime.</p>
  
  <p>The problem is that the dynamically loaded assembly is not in the list of referenced assemblies passed to the C# compiler.  </p>
  
  <p>The generated C# code looks like this:</p>
  
  <pre><code>namespace ASP {
      using System;
      /* Other namespaces */
      public class _Page_MyApp_Views_Home_Index_cshtml
          : System.Web.Mvc.WebViewPage&lt;MyApp.ViewModels.Search.IndexViewModel&gt; {
      /* Generated code */
      }
  }
  </code></pre>
  
  <p>And here is the error message:</p>
  
  <pre><code>Compiler Error Message: CS0246: The type or namespace name 'MyApp' could not be found (are you missing a using directive or an assembly reference?)
  </code></pre>
  
  <p>Do you have any idea why this works with the Webforms view engine but not with Razor ?
  Is there a way to tell the compiler to use my dynamically loaded assembly for the compilation ?</p>
  
  <p>Thanks</p>