So I was persistently getting this error on the System.Web.Optimization package
Could not load file or assembly 'System.Web.Optimization' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I finally found the solution after much trying. The key was in the Assembly load trace.
LOG: Redirect found in application configuration file: 1.0.0.0 redirected to 1.1.0.0.
Here are the steps I took to resolve the issue. It might be possible to skip some of these but this worked for me:
Uninstall the nuget package
Microsoft.AspNet.WebOptimization.WebForms
Delete bin folder
open web.config and locate the redirection.
It will look something like this:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
</assemblyBinding>
I removed the entire assemblyBinding section from the web.config.
Finally re-install the Microsoft.AspNet.WebOptimization.WebForms
package and rebuild.
I don't know where this section came from in the web.config but having removed it everything seems to be working once again.