Razor Intellisense Broken - POSSIBLE FIX

Topics: General
Dec 12, 2014 at 9:23 PM
Edited Dec 12, 2014 at 9:23 PM
Hey Orchard gang - I just had a bang-up, drag out fight with Orchard and VS2013 and prevailed - so I'm posting here to help anyone else who runs into the same issue. Stackoverflow and Google are teeming with these issues, but my solution came the hard way.

I suddenly lost Razor intellisense on all of my views. The project still built and run, but the VS editor was worse than useless - red squigglies everywhere. What's a Model? What do you mean, @Html.Actionlink? Etc. Super frustrating.

I tried everything I could think of - unload / reload the project, replace the web.config file, update all of the references - nothing worked. Importantly, I dropped and re-added the MVC 5 reference from the Orchard lib folder - as you should.

So - I looked at the csproj file after unloading (hint: R-click, unload project, edit [].csproj. You'll see the underlying XML).

That's when I saw this node:
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
     <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
    </Reference>
WTF? Wrong library reference! So, I manually changed it to:
<Reference Include="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
    </Reference>
... reload project, and all is well with the world again.

Clearly more of a VS than Orchard issue, but one I could see biting Orchard devs. So, there you have it. Buy me a beer at the next Harvest if this helped ;-)

Kurt
Developer
Dec 12, 2014 at 11:20 PM
You're definitely getting a beer next Harvest. Thank you for sharing!
Developer
Dec 12, 2014 at 11:31 PM
I've seen the same. Supposedly the reference changed itself to MVC 4 by itself...