Solution to the Sitefinity Error: The located assembly's manifest definition does not match the assembly reference.

by Gregg Crystal Jan 16, 2017

This issue is actually caused by Sitefinity's inline editor. If you log out of Sitefinity and visit the page again, it would load just fine.

sf-mvc-page-dies.png

The simplest solution is merely to add a little code to your web.config file in the assemblyBinding section:

<dependentAssembly>
<assemblyIdentity name="RazorEngine" publicKeyToken="9ee697374c7e744a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.9.1.0"/>
</dependentAssembly>

That did the trick for me. Please note that the publicKeyToken and newVersion were all copied from the error.

Here's the error for those searching:

Server Error in '/' Application.

Could not load file or assembly 'RazorEngine, Version=3.0.8.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'RazorEngine, Version=3.0.8.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:
[No relevant source lines]
Source File: c:\Users\Gregg Crystal\AppData\Local\Temp\Temporary ASP.NET Files\vs\312bdb18\aba8828a\App_Web_default.cshtml#bootstrap.cshtml.39f49bee.ffxomvdn.0.cs    Line: 0

Assembly Load Trace: The following information can be helpful to determine why the assembly 'RazorEngine, Version=3.0.8.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace
:

[FileLoadException: Could not load file or assembly 'RazorEngine, Version=3.0.8.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
Telerik.Sitefinity.UI.MVC.Helpers.InlineEditingHelper.GetInlineEditingManagerControl() +0
Telerik.Sitefinity.UI.MVC.SitefinityExtensions.InlineEditingManager(HtmlHelper htmlHelper, Nullable`1 loadExternalScripts) +282
ASP._Page_Frontend_Assembly_Telerik_Sitefinity_Frontend_Mvc_Views_Layouts_default_cshtml_Bootstrap_cshtml.Execute() in c:\Users\Gregg Crystal\AppData\Local\Temp\Temporary ASP.NET Files\vs\312bdb18\aba8828a\App_Web_default.cshtml#bootstrap.cshtml.39f49bee.ffxomvdn.0.cs:0
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Layouts.LayoutRenderer.RenderViewToString(ControllerContext context, String viewPath, Boolean placeholdersOnly) +354
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Layouts.LayoutRenderer.GetLayoutTemplate(String templateName, Boolean placeholdersOnly) +39
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Layouts.LayoutVirtualFileResolver.Open(PathDefinition definition, String virtualPath) +120
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Layouts.MvcMasterPage.LayoutOutput(String path) +157
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Layouts.MvcMasterPage.ApplyToPage(Page page) +155
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.PageInitializer.PreInitHandler(Object sender, EventArgs e) +132
System.Web.UI.Page.OnPreInit(EventArgs e) +9774930
System.Web.UI.Page.PerformPreInit() +37
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +296

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1586.0

 

Ready to Supercharge Your Sitefinity Project