title: VS2015 - IntelliSense not working in razor views in a class library
body: <p>I am having a hard time describing the exact issue, but is appears to be "just" an IntelliSense problem that only shows in razor (.cshtml) views. Been looking at this for 2 days now so I could really use some help.</p>
  
  <p>I am using VS2015 Pro, started a new Web MVC application (WebApplication2 ) using the standard template. Inside that application everything works just fine.</p>
  
  <p>Now I have added a class library project (the default one, not the "Package" template), and added the WebPages, MVC and razor nuget packages to it (in case that is relevant). The problem becomes visible as soon as I create a new view in the class library. It appears that all references to System libraries are unavailable in the cshtml file.
  With no files opened I get no errors at all, but when I open the view all system classes have the red squiggly line under them, and the Error list (Build + IntelliSense) suddenly contains a lot of errors for every system* library, example:</p>
  
  <pre><code>The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
  </code></pre>
  
  <p>These include Linq, and the WebApplication2 (the test project), so not just System.Web.</p>
  
  <p>Things that I have checked and done bases on similar answers on stack:</p>
  
  <ul>
  <li>The web.config in the Views folder contains the correct versions, also tried just copying the one from the web application.</li>
  <li>Reinstalled the nuget packages (Mvc, Razor, Webpages).</li>
  <li>Resetting the userdata and removing the .vs folder.</li>
  <li>Copy local is set to true on assemblies.</li>
  </ul>
  
  <p>The actual case where we discovered this is our larger web application which was working fine in VS2010, but then we decided to upgrade to 2015 and .Net 4.6. The views in the class library are marked as embedded resource and loaded using a virtual path provider. The case above is a super simplified reproducible project, the symptoms are the same on my and my 2 colleagues' computers.</p>
  
  <p>If I missed a crucial bit of information, please just ask.</p>
  
  <p>Image visualizing the issue
  <a href="https://i.stack.imgur.com/JWCsb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JWCsb.png" alt="Image visualizing the issue"></a></p>