C# ASP.NET MVC PayPal找不到程序集

本文关键字:找不到 程序集 PayPal MVC ASP NET | 更新日期: 2023-09-27 18:36:54

我已经使用 NuGet Install-Package PayPal 安装了PayPal

然后,我使用此处的代码进行测试: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();

在此之后放置了一个断点进行检查,但是当我加载页面时,我得到:

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.

关于如何解决此问题的任何帮助?

编辑

我已经尝试了可能重复的链接中的答案,但没有一个对我有用。

C# ASP.NET MVC PayPal找不到程序集

我刚刚将我的代码复制到一个新的解决方案中,它已经工作了。我唯一能想到的是,这是因为我将解决方案命名为"PayPal",这在某处引起了问题。