title: Getting System.Web.Optimization to work in a razor view within a class library
body: <p>I'm building a modular MVC4 app, where each module (=area) is a class library. Models and controllers compile into the .dll, the views get copied into the appropriate folder. At runtime, everything works fine. At design time there is one annoying problem left: When editing a razor view within a class library, Visual Studio doesn't recognize the System.Web.Optimization Namespace.</p>
  
  <pre><code>The name "Styles" does not exist in the current context.
  The name "Scripts" does not exist in the current context.
  </code></pre>
  
  <p>I tried adding the assembly to the system.web/compilation section in the root and the inner web.config:</p>
  
  <pre><code>&lt;add assembly="System.Web.Optimization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
  </code></pre>
  
  <p>I tried it without the specific version, too. Both methods didn't solve the problem, but triggered an asp.net runtime error (visible in the first line of the razor view):</p>
  
  <pre><code>Could not load file or assembly 'System.Web.Optimization, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
  </code></pre>
  
  <p>The assembly is referenced in the project and 'Copy Local' is set to 'True'. It's also added as a namespace in the razor configuration section.</p>
  
  <p>I suspect it's a general problem i'll encounter with other assemblies in the future.</p>
  
  <p><strong>Edit:</strong> I did the general setup to get Intellisense going in a razor view within a class library. Everything works so far, except that VS2010 doesn't recognize the Optimization Namespace.</p>