C# ASP.NET MVC PayPal not finding assembly - c#

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.

Related

TechTalk.SpecFlow Error

After updating to SpecFlow 2.3.2, I am getting the following error:
Message: Unit Test Adapter threw exception:
Could not load file or assembly 'TechTalk.SpecFlow, Version=2.3.2.0, Culture=neutral, PublicKeyToken=0778194805d6db41' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).
I am using Visual Studio 2017.
Really at a loss here. Any help would be greatly appreciated.

Could not load file or assembly Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.1.0

I have a strange case,the website works fine in local but in server i get:
HTTP Error 502.5 - Process Failure
after extract log i get the error :
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly ' Microsoft.Extensions.DependencyInjection.Abstractions,
Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
when check the uploaded file it's exactly same version

Service reference not defined

I have added a wcf service (SifService) reference to my Kentico web application in VS. I didn't select any of the advanced options. I just provided the wsdl address, provide a namespace (SifService) and click OK. The service reference seems to have added successfully. However, when I attempt to create an instance of the client like in the code below, VS says the type or namespace "SifService" could not be found. We have just recently upgraded from Kentico 8 to Kentico 9. The same exact code works fine in the Kentico 8 code branch. The issue only appears in the Kentico 9 branch.
var sifClient = new SifService.SifClient();
When I attempt to run the site in VS, I get this error in the browser:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Reference.svcmap: Could not load file or assembly 'System.Web.Http, Version=5.2.2.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)
Source Error:
[No relevant source lines]
Source File: /App_WebReferences/SifService/ Line: 1
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
NOTE: Everything runs fine until I add the service reference to SifService.
Sometimes it's an error of visual studio, clean the solution, build, so close the visual studio and build again, for me it worked a few times!

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

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.

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