Looking for the solution. Yes you are at the right place. Once I also faced the same issue when I was working on a MVC project, I got the error states that “The located assembly’s manifest definition does not match the assembly reference” .
When I ran the solution I saw the YSD (yellow screen of death) that simply gave me the assembly name which is causing the issue.
Could not load file or assembly ‘System.Web.Optimization, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31BF3856AD364E35’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. HRESULT: 0x80131040
In my case I have several MVC projects referring to “System.Web.Optimization” , but I’m getting this issue only in newly added project. When I investigated the issue I found that the project referring to the higher version of “System.Web.Optimization”. This is because the dll has been included using nuget and nuget always downloads the latest version of dll.
FYI: The Microsoft.Web.Optimization package is now obsolete. With ASP.NET (MVC) 4 and higher you should install the Microsoft ASP.NET Web Optimization Framework.
Solution: To fix this issue I deleted the higher reference and installed it using using Package Console Manager.
Install-Package Microsoft.AspNet.Web.Optimization -Version 1.0.0
Yupp… Issue has been resolved. But is it the same issue what you have ? May be NO. Alright for that I’m to list all possible solution that I know which will solve your problem.
- Delete the assembly and associated files from projects bin folder and then choose Add Reference to add the latest version back in.
- Delete all the assembly inside bin for all projects and rebuild your project.
- Sometime just cleaning the project and recompiling did the trick. No need to remove/re-add references.
I hope you will refer this article for your need. I would like to have feedback from my blog readers. Please post your feedback, question, or comments about this article.