Could not load file or assembly Exception from HRESULT: 0x80131040 - c#

I added PayPalMerchantSDK to my project through nuget. When I debug it it works perfectly but on live version I am getting exception that dll is not included.
The file or assembly 'PayPalMerchantSDK, Version = 2.14.117.0, Culture
= neutral, PublicKeyToken = 5b4afc1ccaef40fb "or one of its dependencies not found. The manifest definition found the assembly
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for and
determine where the error originated in the code more information
about this error. Exception Details:
System.ServiceModel.FaultException`1
[[System.ServiceModel.ExceptionDetail, System.ServiceModel, Version =
4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089]]: The file or assembly 'PayPalMerchantSDK, Version = 2.14.117.0, Culture =
neutral, PublicKeyToken = 5b4afc1ccaef40fb "or one of its dependencies
not found. The manifest definition found the assembly does not match
the assembly reference. (Exception from HRESULT: 0x80131040)
I already checked:
dll is in bin folder
version, public key token are as required
I added "dependentAssembly" to config
I cleaned, rebuilded project deleted and added library through nuget several times
None of those helped. Any idea what else I can try?

One of the dependancies of PayPalMerchantSDK might be either missing or not the same version referenced from PayPalMerchantSDK.
You might depend on the some component that PayPalMerchantSDK depend on but your dependant versions might differ.

Related

How to fix assembly binding error in .Net core for multiple versions of same nuget package

I have a .Net Core 2.1 App. The 'Microsoft.AspNetCore.App' package here uses the '2.1.0' version of 'Microsoft.Extensions.DependencyInjection' package.
I want to download another third party package which requires the '3.1.0' version of the same 'Microsoft.Extensions.DependencyInjection' package. I have tried to fix this by directly downloading the '3.1.0' version of the package. After doing this, the application builds correctly. But when I try to start the app, I get an error. The event viewer has the following error
Exception Info: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Is there a way to fix this error?

getting TypeInitializationException Oracle.DataAccess

I have Windows 10 machine. In that I am running a c# project which references Oracle.DataAccess.dll. I have installed ODAC112012_32Bit. There is a dll NexFen.FirmLoad which accesses Oracle dll. When I run the project I get following error:
System.TypeInitializationException: The type initializer for
'NexGen.FirmLoad.AppUtils' threw an exception. --->
System.IO.FileLoadException: Could not load file or assembly
'Oracle.DataAccess, Version=4.112.3.0, 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) --->
System.IO.FileLoadException: Could not load file or assembly
'Oracle.DataAccess, Version=4.112.1.2, 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) --- End of inner
exception stack trace --- at NexGen.FirmLoad.AppUtils..cctor()
--- End of inner exception stack trace --- at NexGen.FirmLoad.LoadFirmware.d__0.MoveNext()
Check that your project meets all the following conditions:
You have an Oracle client installed (e.g. Oracle Instant Client)
Oracle.DataAccess.dll and the Oracle Client and the compile target of your application have all the same architecture (i.e. 32-bit vs. 64-bit)
Version of Oracle.DataAccess.dll is the same version as your Oracle client (even the minor version has to match). Your error message indicates version 4.112.3.0 and 4.112.1.2, perhaps there is your problem. Check installed versions in your GAC and Policies.

C# ASP.NET MVC PayPal not finding assembly

I've installed PayPal using NuGet Install-Package PayPal
I'm then using the code from here to test: https://devtools-paypal.com/guide/pay_paypal
Dictionary<string, string> sdkConfig = new Dictionary<string, string>();
sdkConfig.Add("mode", "sandbox");
string accessToken = new OAuthTokenCredential("XXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXX", sdkConfig).GetAccessToken();
I've put a breakpoint after this to inspect, but when I load up the page i get:
Could not load file or assembly 'PayPal, Version=1.7.3.0, Culture=neutral, PublicKeyToken=5b4afc1ccaef40fb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'PayPal, Version=1.7.3.0, Culture=neutral, PublicKeyToken=5b4afc1ccaef40fb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 22:
Line 23: return View();
Line 24: }
Line 25: }
Line 26: }
Source File: c:\users\david\documents\visual studio 2015\Projects\PayPal\PayPal\Controllers\HomeController.cs Line: 24
Assembly Load Trace: The following information can be helpful to determine why the assembly 'PayPal, Version=1.7.3.0, Culture=neutral, PublicKeyToken=5b4afc1ccaef40fb' could not be loaded.
Any help on how to resolve this?
EDIT
I've tried the answers from the link given to the possible duplicate and none of them work for me.
I've just copied my code into a new solution and it's worked. The only thing I can think of is that it's because I named the solution 'PayPal' and this caused an issue somewhere.

Exception with dlls:(Exception from HRESULT: 0x80131040):ThoughtWorks.Selenium.Core, Version=2.12.0.0,

System.IO.FileLoadException: Could not load file or assembly
'ThoughtWorks.Selenium.Core, Version=2.12.0.0, Culture=neutral,
PublicKeyToken=1c2bd1631853048f' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
I am working on a migration project from selenium RC to Selenium webdriver and upgraded my Wedriver dll to version 2.31.2. I have read the posts from stacks for this error and Cleard Bins and cheked .csprj file and done everything still I am getting the same error. Do you have any idea what am I missing here
http://social.msdn.microsoft.com/Forums/vstudio/en-US/0e82b5d2-e777-4c24-9e4d-9bc3f74cbaf7/exception-from-hresult-0x80131040?forum=csharpgeneral
You go for this . in web.config version and assembly version must be same.

Problems upgrading MVC Mini Profiler to latest release

I've been using Mini Profiler in dev and production (azure) for a while and LOVE it.
It tried to upgrade to the latest release today via NUGET. The DLL get's placed in the bin but my site gets an error. If I go back to the old dll it works fine. Does anyone know how to fix this?
Server Error in '/' Application.
Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, 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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, 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)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, 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)]
MyGlobal.application_BeginRequest(Object sender, EventArgs e) in C:\Users\Nate\Documents\Visual Studio 2010\Projects\TrainerRoad\com.TrainerRoad.DataAccess\MyGlobal.cs:15
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
Be sure to read the documentation on http://code.google.com/p/mvc-mini-profiler/
In particular:
Ensure you remove all the modifications you made to web.config.
If you are profiling Entity Framework grab the MiniProfiler.EF package
If you are running latest EF see: Problem using SQL Server CE with Entity Framework code-first and ASP.NET MVC 3 and mvc miniprofiler
There is not MiniProfiler version 2.0.4177.17902 so I really do not know where it is coming from.

Categories

Resources