So, I had a ASP.NET MVC application, but everything was in 1 project. (ugh)
I decided to get a little closer to how it's done in the field, and split up into different projects in one solution.
After doing so, I spent some time adding all the needed assemblies to my new DataAccess project, adding it as a dependency to the other project etc. To have it not run and throw the error:
Could not load file or assembly 'MySql.Data.Entity.EF6, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
So clearly something was wrong with the MySql.Data.Entity.EF6 reference.
I spent hours searching for a solution, from changing the versions in my web.config to completely deinstall and reinstall the dependency, but no matter what I did, the error was here to stay.
If you've tried what I've tried (no matter the reference you're stuck with) It might be a good idea to check if it's been referenced in any other project in your solution.
If so, delete the reference from the other project (not the DataAccess project). And make sure you have the right versions in your web.config. You can check the versions via properties in VS.
When I did that, everything suddenly worked just fine.
Related
I have a Solution with many different project types in (Class File, ASP.net MVC 5, ASP.net Core 2.1). When I try and build the Solution I get this error:
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)
However, there is no associated project name. Project, File, Line are all empty.
How can I find out which project is causing the error? How can I trouble shoot this?
I can find various Google results for the particular error - but if the compiler doesn't even tell me which project is at fault - how can I begin to fix it?
Thanks.
Update:
What are the valid reasons for the compiler not supplying the name of the project at fault, if any?
System.Web.Mvc is a namespace used by MVC 5 so the error is likely occurring in your MVC 5 project (https://learn.microsoft.com/en-us/previous-versions/aspnet/web-frameworks/dd492706(v=vs.118)).
One quick fix would be to ensure that the package is in your project. If you find that it's missing, generate a new project and copy over the binary from the bin directory of that project to your project.
Another thing you can try is deleting the reference to the package and adding it back. This should resolve any dependency issues regarding a version mismatch or file reference error.
I took over a project recently and it's using the NopCommerence package. When I load up the package in Visual Studio, it works fine, I have no troubles in VS, when I push live, everything is fine too, all works, but as soon as a few days sometimes even hours have passed, I get this error message:
Could not load file or assembly 'NPOI, Version=2.0.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
To solve this, I have to clean, rebuild and build the project and release a new set of files, my question is why does it randomly just fall over after so much time? I tried resetting the server, deleting temporary files but no luck.
Been doing this for weeks now and I can't find a solution.
This seems to be an issue where your .NET assembler is looking for an assembly of a specific version and instead of finding that, it is finding the assembly of that same thing, but of a different version.
It means that it wont work until both the files, i.e the actual file at the location and the reference in your configuration are same.
Check your config and then check on the actual file. If its of older or newer version, then replace it with the version that is actually required.
Here are a few links for your reference.
Assembly version mismatch
Resolving assembly conflicts
Hope this helps.
Im having some serous issues with a .dll not being found in Nop.Core.dll (i think)
the dll message the PluginManager.cs writes in the output in VS12 is as follows:
Could not load file or assembly 'Telerik.Web.Mvc, Version=2012.2.607.340, Culture=neutral, PublicKeyToken=29ac1a93ec063d92' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Ive added the right version of Telerik.Web.Mvc to the Nop.Core lib and built a new .dll but the issue still remains.
Ive also checked for cached .dlls in th GAC but nothing.
The issue occured after a restart of VS12 so there´s smt weird going on here. Ive tried disabling/enabeling auto update nuget on build (as i thought that it might be fetching some new dlls that might create a conflict) but nothing.
I do see that the Solution is running .net 4.5 but the Telerik.Web.Mvc.dll target framework is :
TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName=".NET Framework 4")].
Can this cause some dll´s to not find Telerik.Web.Mvc.dll?
As im new to nopCommerce im kinda lost at this point. What am i doing wrong here? =)
/seb
Edit:
Make sure you have non-corrupted Telerik.Web.Mvc.dll in your bin folder (download one that comes with nopcommerce and overwrite it to be sure)
This issue may be caused by a plugin that has wrong reference. If you have any custom/old plugins try removing them or readd their reference and recompile.
Current version in 3.10 is 2013.2.611.340 while you have reference to 2012.2.607.340
This was all working fine when I had two separate solutions - a webApi solution and a MVC solution. I'm trying to pull the MVC solution into the WebAPI one to consolodate everything but I keep getting random reference errors. The latest is:
Could not load file or assembly 'System.Web.Http, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference.
I've searched and searched but I can't find a solution. I've deleted my bin, rebuilt, uninstalled MVC, reinstalled it, made sure "Specific version" is set to false... I'm stuck and frustrated. What else could be causing this?
I get the error when I try to load the MVC application.
Does one project reference the other ? Looks like framework mismatch : verify that both your projects use the same version (3.5 or 4.0) and flavor (full version, not client) of the framework
Warning 1 D:\MyPath\SomeAscx.cs: ASP.NET runtime error:
Could not load file or assembly 'HtmlAgilityPack,
Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a'
or one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have removed the reference and am not using it in code why would this still be an issue. I have tried cleaning solution, rebuilding, open and closing solution but still no success. Has anyone come across this issue before?
Even if you removed direct references, something else might still require that dll.
I'd suggest:
Recycle your IIS application pool (or run IISRESET from the command prompt to reset the entire web server)
turn on FusLog and check who is the real "offender"
This can happen if your project name conflicts with a nuget package you referenced. I wasted about 30 minutes before I realized what is going on.
I was doing a ReactJS tutorial, so I created a project called React, and then later I imported ReactJS.NET from nuget.
When I hit build, Visual Studio will build React.dll in bin folder since my project name is React, this dll overwrites the React.dll imported by nuget package ReactJS.NET
So my project blew up... and I wasted 30 minutes scratching my head.