Strange error every second build Facebook SDK C# - c#

I keep getting this error:
Could not load file or assembly 'Facebook, Version=5.4.1.0, Culture=neutral, PublicKeyToken=58cb4f2111d1e6de' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Can anyone help me?

I faced a similar problem once when there were two different assembly versions available and when the assemblies were copied across projects with some inconsistently set assembly references. The versions got mixed up and the error appeared.
But take a look a this and links provided there, it should give you some suggestions or ideas:
The located assembly's manifest definition does not match the assembly reference

Related

Testing.fakes error when I try to debug my C# app

I have a solution with 5 projects, one of them is a unittest and another one is an API Rest (donno if this is relevant hehe) . The problem I have is that when I added this unittest, I couldn't debug again my API, all the time a ' System.IO.FileNotFoundException' appears and I can't do nothing.
How could I fix this problem?
I tried removing all references via Visual Studio but still it is not working.
Could not load file or assembly 'Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Thanks!

Load assembly from local directory and not GAC

I am trying to write a 'hello world' application with a dependency to an assembly of a CAD software (SpaceClaim). I add the assembly SpaceClaim.Api.V12.dll to my references and build without problems. When I try to run the application I get the following error:
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly 'SpaceClaim.Api.V12, Version=12.1.11373.0,
Culture=neutral, PublicKeyToken=7210645d4d5e3a39' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'SpaceClaim.Api.V12, Version=12.1.11373.0, Culture=neutral,
PublicKeyToken=7210645d4d5e3a39'
---> System.IO.FileLoadException: Could not load file or assembly 'SpaceClaim.Api.V12, Version=12.1.8703.0, Culture=neutral,
PublicKeyToken=7210645d4d5e3a39' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) File name:
'SpaceClaim.Api.V12, Version=12.1.8703.0, Culture=neutral,
PublicKeyToken=7210645d4d5e3a39'
(this error message is also discussed here)
After checking the GAC, I can see that there is an assembly with same strong name with the one I am referencing (Version=12.1.8703.0). However when I open these two with a disassembler (ILSpy), I see that they target different runtimes, the one I am referencing targets .NET 2.0 and the one in the GAC .NET 4.0.
I would like to ignore the one in the GAC and pick from the local directory the one that targets NET 2.0. Apparently, simply copying it into the same folder with the executable is not enough. From what I 've read so far here and here, in order to do this, one needs to 'remove the signing' from the assembly. I don't have much experience with .NET so I am wondering, is this something that I can do with 3rd party assembly and if yes how? Or what other alternatives I have? The two assemblies have the same strong name so putting them both in the GAC is not an option as far as I understand.

log4net manifest definition mismatch

I'm getting this issue while running test client
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I found many solutions like adding both versions, or enable logging in registry but nothing worked for me. I'm just stuck over here.
Anyone has any idea regarding this then please help me out. Any kind of help will be appreciated.
I expect you have a reference mismatch between two different assemblies with one expecting version 1.2.10.0 of log4net and another some other version. One version of the log4net assembly is copied to your output directory when your solution is built and then when your program is launched the .exe loader is then complaining because it isn't able to load the version of particular assembly (or .exe) is expecting. Upgrading / downgrading your assemblies to use the same version of log4net should solve the problem.

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.

SolrNET - Could not load file or assembly 'HttpWebAdapters' when pulling from Nuget

I am using Nuget to get the latest version of SolrNET and StructureMap.SolrNetIntegration in my ASP.NET MVC project.
x.IncludeRegistry(new SolrNetRegistry(((SolrConfigurationSection)ConfigurationManager.GetSection("solr")).SolrServers));
When the above line of code is invoked I receive the following error:
Could not load file or assembly
'HttpWebAdapters, Version=0.3.0.0,
Culture=neutral,
PublicKeyToken=bc21753e8aa334cb' or
one of its dependencies. The located
assembly's manifest definition does
not match the assembly reference.
(Exception from HRESULT: 0x80131040)
I am concurrently upgrading to the latest version (0.3.0) as well as pulling solrnet from Nuget for the first time - previously this same code worked with the previous distribution downloaded directly from the SolrNET site. I can see that the issue occurs in the structuremap.solrintegration project when constructing the solrnetregistry, but I'm at a loss as to why
[FileLoadException: Could not load file or assembly 'HttpWebAdapters, Version=0.3.0.0, Culture=neutral, PublicKeyToken=bc21753e8aa334cb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
StructureMap.SolrNetIntegration.SolrNetRegistry..ctor(SolrServers solrServers) in c:\prg\SolrNet\svn\StructureMap.SolrNetIntegration\SolrNetRegistry.cs:40
myproj.Core.BootStrapper.<ConfigureStructureMap>b__1(IInitializationExpression x) in C:\Users\jp\Documents\Visual Studio 2010\Projects\myproj\myproj.Core\BootStrapper.cs:66
StructureMap.ObjectFactory.Initialize(Action`1 action) +143
myproj.Core.BootStrapper.ConfigureStructureMap() in C:\Users\jp\Documents\Visual Studio 2010\Projects\myproj\myproj.Core\BootStrapper.cs:37
myproj.Core.MvcApplication.Application_Start() in C:\Users\jp\Documents\Visual Studio 2010\Projects\myproj\myproj.Core\Global.cs:131
Does anyone know if something has changed or if I am doing anything incorrectly?
Thanks
JP
The SolrNet.StructureMap NuGet package was incorrectly built. I already fixed it and sent a pull request to the NuGet team. EDIT: the fix is in.

Categories

Resources