I\'ve been working on an MVC 4 solution, and I\'ve been trying to upgrade it to MVC 5. I\'ve followed the steps outlined here.
I\'ve followed it, and now whenever I run
Looks like you still have a reference to Razor 2.0 dll.
Check your project references' properties - especially 'Use specific version' one.
Check for version in web.config. If it again gives an error, try to clean the solution and rebuild it. Also check for project's Bin folder, removes old references from bin folder and rebuild the project solution.
In your Web.config
(-s) make sure assemblyBinding
contains the proper version for the assembly System.Web.WebPages.Razor
and System.Web.Mvc
.
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
And make sure that razor sectionGroup
in ConfigSections
reference latest versions as well:
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
</sectionGroup>