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.

davelowe85
  • 1,099
  • 1
  • 12
  • 25
  • Possible duplicate of [HRESULT: 0x80131040: The located assembly's manifest definition does not match the assembly reference](http://stackoverflow.com/questions/93879/hresult-0x80131040-the-located-assemblys-manifest-definition-does-not-match-t) – Gusman Feb 29 '16 at 14:11
  • Is your project in one solution ? or do you have multiple projects/libraries etc? – James Dev Feb 29 '16 at 14:27
  • @JamesDev It's all in 1 solution. I've tried everything on that link posted about the duplicate question but nothing has worked. – davelowe85 Feb 29 '16 at 14:43
  • Could you right click on the Paypal dll in you references folder and check the version from there and post it here. – James Dev Feb 29 '16 at 14:44
  • @JamesDev it looks like it was because I had named my Solution ''PayPal' – davelowe85 Feb 29 '16 at 15:37

1 Answers1

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.

davelowe85
  • 1,099
  • 1
  • 12
  • 25