After copying an Episerver solution to a new environment the following error may occur in the Log4Net logs.
2017-12-05 12:53:09,615  ERROR EPiServer.Framework.Initialization.InitializationEngine: Type lookup failed detail #1 LoaderException (limit 20): System.IO.FileLoadException: Could not load file or assembly 'System.Web.Razor, Version=220.127.116.11, 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)
File name: 'System.Web.Razor, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
- Open the Package Manager Console
- Tools > NuGet Package Manager > Package Manager Console
- Change the package source to Microsoft and .Net.
- Change the project to the one you are debugging.
- Run the following command.
Update-Package Microsoft.AspNet.Mvc -Reinstall