Sitecore 10.1.0 Helix Project Publish issue - Could not load file or assembly 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

 Error:

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

Line 276:        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
Line 277:        <add assembly="System.Web.Helpers, Version=3.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
Line 278:        <add assembly="System.Web.Mvc, Version=5.2.4.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
Line 279:        <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
Line 280:        <add assembly="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />

Source File: c:\inetpub\wwwroot\sc1010latestsc.dev.local\web.config    Line: 278

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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].


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

Cause:

This error is thrown based on settings in the web.config. Or, in other words, the version of System.Web.Mvc specified in the web.config is not present in the web app root bin folder. This happened as soon as I published my Visual Studio project. I then did the following steps:

1. I usually have a copy of the web app root bin folder to cross-check if the version of the dll is different. 

2. Next, I go to the Visual Studio project references to find the dll version. Here is the result:


From the above screen shot, you can find the reason for the issue. The dll version (5.2.7.0) is different from what is specified in the web app root web.config file and since copy local is set to true, this dll has gone ahead and overwritten the bin folder dll.

3. Now, there are a couple of options here:

a. Since the dll version specified in the web.config is older compared to what is in the project references, accommodate the new version (as shown below), refresh the page and the issue must be resolved -


b. The next option is to copy the original 5.2.4.0 version to the bin folder from the backup and set copy local as false for the concerned dll in the project references so that the next time, the dll is not overwritten during publish.

I went ahead with option b in this case since I didn't want to experiment with the website instance in anyway!



Comments

Popular Posts