C# ASP.NET MVC PayPal not finding assembly
Asked Answered
A

1

2

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.

Anthology answered 29/2, 2016 at 14:6 Comment(5)
Possible duplicate of HRESULT: 0x80131040: The located assembly's manifest definition does not match the assembly referenceProcedure
Is your project in one solution ? or do you have multiple projects/libraries etc?Upanchor
@JamesDev It's all in 1 solution. I've tried everything on that link posted about the duplicate question but nothing has worked.Anthology
Could you right click on the Paypal dll in you references folder and check the version from there and post it here.Upanchor
@JamesDev it looks like it was because I had named my Solution ''PayPal'Anthology
A
3

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.

Anthology answered 29/2, 2016 at 14:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.