MVC cannot be cast to System.Web.WebPages.Razor.Configuration.HostSection due to the NuGet Management Pack upgrade of some referenced DLL components

Source: Internet
Author: User
Tags pack

[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 Context "Default") In the "C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\ System.Web.WebPages.Razor.dll "location). Type B originates from "System.Web.WebPages.Razor, version=3.0.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35" (in Context "Default" In the "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary asp.net files\root\ca1e2ed7\e63e822b\assembly\dl3\ B59e4f69\9fee0547_fac4d001\system.web.webpages.razor.dll "location).


Modification method: Main change a place to ~/view/web.config changes

Before modification:

<configSections>
<sectiongroup name= "System.web.webPages.razor" type= " System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, version=2.0.0.0, Culture =neutral, publickeytoken=31bf3856ad364e35 ">
<section name= "host" type= "System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, version=2.0.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35 "requirepermission=" false/>
<section name= "pages" type= "System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, version=2.0.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35 "requirepermission=" False "/>
</sectionGroup>
</configSections>


After modification

<configSections>
<sectiongroup name= "System.web.webPages.razor" type= " System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, version=2.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>
</configSections>

Change the red version to [B] corresponding version, such as: Front is [a]2.0.0.0 version, change to 3.0.0.0


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.