title: Need razor view engine auto-complete to work in a class library?
body: <p>We have a modular architecture where we have some views (cshtml) files in a separate project (class library).  How can we get the <del>syntax highlighting and</del> autocomplete to work when the project isn't an MVC project?</p>
  
  <p>Please note that the class library has controllers, views, models etc.  It just doesn't have the web.config, global.asax, etc that a normal mvc project would have.</p>
  
  <p>The intellisense works for everything but the so important model:
  <a href="https://i.stack.imgur.com/x9ftv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x9ftv.png" alt="screenshot of model error"></a>
  </p>
  
  <p>With MVC3 RTM, if you hover over the Model, you can now get a better error message:</p>
  
  <blockquote>
    <p>C:\...\Index.cshtml: ASP.NET runtime
    error: There is no build provider
    registered for the extension
    '.cshtml'. You can register one in the
    &lt;compilation>&lt;buildProviders>
    section in the machine.config or
    web.config.  Make sure is has a
    BuildProviderAppliesToAttribute
    attribute which includes the value
    'Web' or 'All'.</p>
  </blockquote>
  
  <p>So I added this:</p>
  
  <pre><code>&lt;compilation&gt;
      &lt;assemblies&gt;
        &lt;add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;/assemblies&gt;
      &lt;buildProviders&gt;
        &lt;add
           extension=".cshtml"
           type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/&gt;
      &lt;/buildProviders&gt;
    &lt;/compilation&gt;
  </code></pre>
  
  <p>Then after adding the build provider, this error message appears:</p>
  
  <blockquote>
    <p>C:\...\Index.cshtml: ASP.NET runtime
    error: Could not load file or assembly
    'System.Web.WebPages.Razor' or one of
    its dependencies. The system cannot
    find the file specified.
    (C:\...\machine.config line 259)</p>
  </blockquote>