0

Getting this error when working on nopcommerce theme

[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:\Users\Designer_2\AppData\Local\Temp\Temporary ASP.NET Files\root

\c152d41b\a654685e\assembly\dl3\d2c346c5\cbf4b46b_e2d3ce01\System.Web.WebPages.Razor.dll'.

Please advise how to solve?

1
  • Can you please provide the code where you're performing the cast? Commented Mar 20, 2014 at 13:49

1 Answer 1

1

Make sure in the web.config in your application root and Views folder are referencing the same version of Razor that you're referencing in your project, similar to below:

<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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.