Assembly's definition does not match - c#

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.

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!

All files containing assembly references

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.

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.

Assembly reference resolves to different path than what was specified

I'm trying to reference Oracle.DataAccess.dll in my c# project assembly. When running the project I get the following error:
Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.50, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I'm really confused because when I right click references and add an assembly I navigate to a copy of the dll that I have in a folder contained within the project and add the reference. When I look at the properties of the reference, though, it shows a path of
C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\Profile\Client\Oracle.DataAccess.dll
and sure enough there is a dll in there by that name, but it's an old version. Why does this reference not point to the path that I specified when adding it, and how can I get it to use the dll at the location that I specified?
We take a couple of steps to resolve issues like this when we know that the specific version does not matter to the built application:
1) In the properties for the reference within the project, ensure the Specific Version property is set to False.
2) Save the project, the edit it in notepad or the text editor of your choice. Find the DLL reference and remove all version and key information and ensure the hint path points to your copy of the file. For example:
<Reference Include="Oracle.DataAccess">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Assemblies\Oracle.DataAccess.dll</HintPath>
</Reference>
Visual Studio can be a bit flaky when it comes to references. Many times we have to just edit the project file directly. Setting the properties of the reference directly doesn't always stick. Right-click your project, select Edit Project File, and make the change there. It should stick.

Categories

Resources