I have set my assembly reference as shown above to the my Web Api project. After compiling, it shows correct dll on the webapi's bin folder. But when I ran the app, it automatically changes to the older dll (ver 4.0). This is happening only for the bin folder's assembly. The web api's reference still shows the correct version (5.2.3). This is really strange. Could you tell me how to sort out this issue ? Thanks in advance.
It returns this error due to auto changed the assembly :
Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Related
I have developed a class library (dll) that uses WinSCPnet.dll in Visual Studio 2015. While troubleshooting why it was looking for the wrong dll, I added the Nuget for it, getting the most recent version. The version we are using is actually a few before that, so I uninstalled the latest (using Nuget) and installed the version I want. Now, when it runs, it is looking for the newest version.
System.IO.FileLoadException: Could not load file or assembly
'WinSCPnet, Version=1.6.5.9925, Culture=neutral,
PublicKeyToken=2271ec4a3c56d0bf' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
I have tried searching the registry, gacutil /u (which ran successfully and removed the dll but I still get this message), cleaned the project and rebuilt, deleted everything in bin and obj and rebuilt - what am I missing?
Thanks!
Try this :
Unload your project , right click, edit .csproj file .. find your reference , it's gone be something like this <Reference Include="WinSCPnet, Version=1.6.5.9925 .../>", edit that create open close Reference tag <Reference></Reference>
Inside put <HintPath>path to your dll file here</HintPath>
Hope this helps!?
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.
So I started working on an existing project at work in NopCommerence and I accidently added the Newtonsoft.Json DLL to the Nop.Core project, ever since then, the project keeps randomly crashing giving me the error:
Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0,
Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0,
Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I removed the reference from the project right away, so there is now no reference to this DLL in the Nop.Core project.
But there is some code in the project which looks for the reference:
When we get to that plugin it crashes here:
I got no clue where to even look to solve this, it looks like it's trying to load two different versions of the DLL and when I Google around, it says to update though NuGet and I did this and nothing has solved it.
So you removed the reference, but what about the actual dll file? It looks like something is 'discovering' it at runtime and it exists on your disk somewhere and the application is finding it.
It's hard to know what to suggest but try to find out where the app is looking for plugin files, then look in that directory and delete the Json stuff. You could also try just deleting all of the bin and obj directories in the whole solution, since they will be re-created by the next build. Also look in the packages directory in the root of your solution, you may find a copy of the Json package lingering there. If you;ve definitely removed it using NuGet, then delete it from packages too.
Make a backup copy before you start, just in case my suggestions are complete rubbish ;-)
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
I'm trying to compile an application for which I have the solution and can't get past:
'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource'
is defined in an assembly that is not referenced. You must add a
reference to assembly 'Microsoft.Practices.EnterpriseLibrary.Common,
Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
So I added the assembly to the GAC:
After some research I opened up visual studio with the Fusion Assembly Binding Viewer running, which seemed to create a lot of logs but none that related to this exact version of the assembly (however 4.1.0.0 is in there).
I can't simply add -> reference as VS tells me that a reference with the same name already exists.
What other avenues should I explore?
Have you tried to Alias the assembly also if you are using .net 4.0 you would have to have an entry in the .config file for example that shows the old assembly name referencing the new assembly name. Several other things to keep in mind .. if the .DLL is in the GAC and you don't have a copy of that assembly in the bin folder, this could cause an issue..
Is this local referencing or is the code on a remote machine ..? if it's a remote machine.. why not add that specific assembly to the GAC.. notice the versioning difference of the two assembly's in your screen shot as well..