Tuesday, November 27, 2012

Investigations: Could not load type 'System.Web.Razor.Parser.[TypeName]' from assembly 'System.Web.Razor, Version='

I recently faced this issue while working on my ASP.NET MVC 4 project over .NET Framework 4.5.

System was throwing following error whenever I make a call to any member of RazorEngine.Razor class.
Like Razor.Parse, etc.
In order to investigate the issue, I checked at various places in my project and GAC, and finally I could see following been placed in web.config file of  my project. It seems it is incorrectly creating the binding redirect for System.Web.Razor.

        <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />

Remove this section from web.config file, and the issue should be resolved now.

No comments:

Post a Comment

Thanks for visiting my blog.
However, if this helped you in any way, please take a moment to write a comment.