title: [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection
body: <p>I got this error after updating mvc framework to 5.2.2.0 using nuget</p>
  
  <blockquote>
    <p>[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast
    to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A
    originates from 'System.Web.WebPages.Razor, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
    'Default' at location
    'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
    Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context
    'Default' at location
    'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
    Files\vs\36d3424f\d8d844c3\assembly\dl3\a0b68557\24516c31_ea0dd001\System.Web.WebPages.Razor.dll'.</p>
  </blockquote>
  
  <p>On web.config</p>
  
  <pre><code>&lt;appSettings&gt;
      &lt;add key="webpages:Version" value="3.0.0.0" /&gt;
    ...
    &lt;/appSettings&gt;
  
      &lt;runtime&gt;
          &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
                &lt;probing privatePath="Plugins/bin/" /&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="FluentValidation" publicKeyToken="a82054b837897c66" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.4.0.0" newVersion="3.4.0.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /&gt;
                  &lt;bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /&gt;
                &lt;/dependentAssembly&gt;
                &lt;dependentAssembly&gt;
                  &lt;assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /&gt;
                  &lt;bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" /&gt;
                &lt;/dependentAssembly&gt;
              &lt;/assemblyBinding&gt;
  &lt;/runtime&gt;
  </code></pre>