In my case, it was an incompatibility problem. I had theses pacakges:
Microsoft.AspNet.Mvc version 4.xMicrosoft.AspNet.Razor and Microsoft.AspNet.WebPages , version 3.x
I assume that upgrading Mvc to 5.x would work, but I needed to keep Mvc 4.x, so I had to downgrade Razor and Mvc to 2.x. To do this, you just need to install an older version, for example:
Install-package Microsoft.AspNet.WebPages -version 2.0.30506 Install-Package Microsoft.AspNet.Razor -Version 2.0.30506
After overriding these packages, the first error disappeared, but there was another error related to the problem in web.config . I had to change the binding binding for Razor:
<dependentAssembly> <assemblyIdentity name="System.Web.Razor" ... /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly>
I donβt know why, but the binding redirection was not updated by the Nuget installation that was supposed to do this.
JotaBe Jun 07 '16 at 2:37 p.m. 2016-06-07 14:37
source share