All files containing assembly references - c#

Trying to hunt down a way to fix this error without building a new solution.
I have removed and re-added the Json reference with no luck inside VS.
Could not load file or assembly 'Newtonsoft.Json (1)' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
It looks like it somehow was referenced twice since it has (1) in it.

In my experience, that sort of error tends to happen if the assembly is renamed. The (1) looks like it may be the case.
I would try removing the reference (all instances of this particular reference) and either readding the original file, or getting it again from NuGet. If NuGet is not an option, check the filename of the physical file you're referencing, and make sure there's no (1) on the end of that.

Found the file in the bin folder and just deleted it. Works now.

Related

ASP loading assembly(dll) error

I have an ASP application and I am using the functionality of exporting to Word ( from my RadEditor).
Now I have the following dll and I have placed it in the right folder from where the system should reference it and I want my system to reference only this version of dll :-
Telerik.Windows.Documents.Core.dll
Version 2016.3.1021.40
But whenever I am doing exporting to word it is throwing the below error :-
Could not load file or assembly 'Telerik.Windows.Documents.Core, Version=2015.3.930.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Now can anyone please advise why my system is pointing to Version=2015.3.930.45 when I have Version 2016.3.1021.40, and I did not keep any other version of that dll except the Version 2016.... anywhere in my entire project or what can be done in this situation . ThankYou !
You can try any of the following:
The reference in the config file entry is still pointing to old version. Try to remove the dll and clear the entry in config and re-add
Sometimes cleaning the solution and re-building should simply fix this. (you can try cleaning bin and obj folders manually before doing this)
Remove Temporary Files C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
Or any other Telerik DLL which has dependency on this is still using the older version. Try to update all the DLLs related to Telerik Or try to use the DLLs of same versions

How to resolve "The located assembly's manifest definition does not match the assembly reference." error?

I downloaded source code for pdfiumviewer from git hub. I made changes to one of the projects in that solution.Then I added that project to my application and added reference of that project to one my application's project.I had to uncheck the Signing option for the PDfiumViewer project, as some of the dll in that project are unsigned.I am able to build the application successfully.But at run time when I create an object of one of the class of PDfiumviewer project.It gives me the following error:
Could not load file or assembly 'PdfiumViewer, Version=2.11.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
The version number of the assembly is correct.So, why am I getting this error?
The problem was that I had added reference of old unmodifed PdfiumViewer dll to another project.Hence, there was conflict between the two dlls (old and customized) at runtime.I removed the old dll reference and it worked.
Ive also encountered this issue, my scenario was thou that I had to add a reference from another solution into my project removing the reference was not an option - what worked for me was reinstall SQLclient from nuget package managerer on both solution. Hopes it helo someone else
The issue here is that you have a library that references v2.11.0.0 of the Pdfium library. This library could be an assembly that you built earlier, or another assembly that came from Pdfium that references this version of the library. When you built your version of the library you probably didn't use this same version number, and it wouldn't have been strong named correctly. To fix this, you can add an assembly binding redirect in your applications configuration file to redirect the offending library to your custom built one.
I wrote a program to fix this issue automatically: https://github.com/BackTrak/DependencyFixup/releases/tag/1.0.0.0
I know this question is old, but hopefully this helps out others!

Assembly's definition does not match

Error 2 Could not load file or assembly
'CrystalDecisions.Enterprise.Framework, Version=10.2.3600.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
Can anyone tell how to correct this error?
I tried to delete the files from the bin folder and I even tried downloading a new dll file and added reference to it. Still it didnt work out.
The solution was pretty simple. Just delete the assembly and associated files from my projects bin folder and then choose Add Reference to add the latest version back in.
This can be due to your project file referring to one version while the version copied into the bin folder is a different one. So when the app runs it's trying to load the version the project file references, but finds only the one copied into the bin folder.
Was the library added through Nuget? It could be that the version in the referenced in packages.config and used in the build doesn't match the version number in the project file.

FileLoadException: The located assembly's manifest definition does not match the assembly

I downloaded a NuGet package for a project (Episerver). I'm trying to replace one specific dll with one of my one of my own implementation, with same name, same namespace, etc... by deleting the dll downloaded from Nuget and loading mine as a reference.
Everything compiles fine, but when trying to execute it, I get the following error:
Could not load file or assembly 'Mediachase.Commerce.Website, Version=7.10.1.169, Culture=neutral, PublicKeyToken=6e58b501b34abce3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Does anyone have a clue on how I can solve this issue? Because I've been smashing my head quite some time against that problem, checked endless forums, and couldn't find any solution that works for me.
Thanks!
That won't work - you have to rebuild assemblies referencing the one you've replaced as well. You can try to use reflector to make c# code from those assemblies referencing your dll and rebuild those assemblies.

ASP.NET - Assembly Not Found

I have a ASP.NET project running on IIS7. I just adding Microsoft.Practices.EnterpriseLibrary.Common.dll, Microsoft.Practices.EnterpriseLibrary.Data.dll, & Microsoft.Practices.EnterpriseLibrary.ObjectBuilder2.dll.
I am receiving this error:
Error 2 Could not load file or assembly 'Microsoft_Practices_EnterpriseLibrary_Common' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I researched the issue and found this means that the dll is not in the right location but it is in my projectdirectory/bin folder. So I do not understand where else it should be referenced. It isn't referenced in my Web.config but assemblies tag was not generated in the project template.
Do I need to reference these assemblies? If so, where do I find the necessary attributes i.e. PublicToken, etc.?
Sometimes this problem occurs with other tools/frameworks as well. Without pulling your hair out, just add a reference to the missing assembly and make sure to set those references to "Copy Local" = true. I notice with framework APIs that are placed in the GAC tend to have this issue.
If its a "web site" project you can just throw the dlls in the bin folder. However if its a "web application" project, you'll need to add a reference and set copy local=true.
I have corrected the issue. I'm not sure why but I had to create a new folder in my project and moved the dll's there and I was able to build the solution. This is a web site project.

Categories

Resources