c# - [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection -
i got error after updating mvc framework 5.2.2.0 using nuget
[a]system.web.webpages.razor.configuration.hostsection cannot cast [b]system.web.webpages.razor.configuration.hostsection. type originates 'system.web.webpages.razor, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' in context 'default' @ 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 'system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' in context 'default' @ 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'.
on web.config
<appsettings> <add key="webpages:version" value="3.0.0.0" /> ... </appsettings> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatepath="plugins/bin/" /> <dependentassembly> <assemblyidentity name="fluentvalidation" publickeytoken="a82054b837897c66" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.4.0.0" newversion="3.4.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="autofac" publickeytoken="17863af14b0044da" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.5.0.0" newversion="3.5.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="webgrease" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.6.5135.21930" newversion="1.6.5135.21930" /> </dependentassembly> <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="entityframework" publickeytoken="b77a5c561934e089" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="antlr3.runtime" publickeytoken="eb42632606e9261f" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.5.0.2" newversion="3.5.0.2" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.net.http.formatting" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.http" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.http.webhost" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.1.0.0" newversion="5.1.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.helpers" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.webpages" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> </assemblybinding> </runtime>
we had same issue . resolved applying 2 fix : 1) there 2 web.config file . need change in root , view web.config files . 2) need check appsettings , check below webpages tag .
Comments
Post a Comment