After upgrading to MVC 5, I encountered the following 2 errors. To fix them, I installed the following Nuget packages.
Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.
Install-Package -Id Microsoft.AspNet.WebHelpers
Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.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)
Install-Package Microsoft.AspNet.WebPages.Data