C# ASP.NET MVC PayPal not finding assembly

℡╲_俬逩灬. 提交于 2019-12-24 17:27:32

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/35701635/c-sharp-asp-net-mvc-paypal-not-finding-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!