【问题标题】:Google plus api with Nopcommerce - Could not load file or assembly System.Net.Http.Primitives带有 Nopcommerce 的 Google plus api - 无法加载文件或程序集 System.Net.Http.Primitives
【发布时间】:2014-10-11 21:30:21
【问题描述】:

我正在尝试使用 Google Plus api 为 NopCommerce 项目开发一个插件。我在 google 控制台上启用了 Plus api,并在我的插件中使用了使用 Nuget 的 api。

PlusService plus = new PlusService(
                 new Google.Apis.Services.BaseClientService.Initializer()
                 {
                     ApiKey = "api_key_here"
                 });

            if (plus != null)
            {
                activitiesresource.listrequest list = plus.activities.list("user_id_here", new activitiesresource.listrequest.collectionenum());


                activityfeed feed = list.execute();
}

我收到以下错误:

无法加载文件或程序集 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f711d50a3a' 或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。

我尝试了这个问题的步骤:Could not load file or assembly System.Net.Http.Primitives. Located assembly's manifest definition does not match the assembly reference

我尝试通过选择 nuget 的预发布选项并将 <dependentAssembly> 添加到插件的 web.config、Web 项目、machine.config、插件的 app.config 和所有组合来更新软件包。但还是没有运气。

任何帮助将不胜感激。

【问题讨论】:

    标签: c# asp.net .net google-plus nopcommerce


    【解决方案1】:

    没有加载任何插件 web.configs,所以没有必要尝试。

    确保在插件和 Nop 项目中引用相同版本的程序集。如果 Nop 已经打开了同名的程序集,则不会加载插件文件夹中的程序集。

    如果您的插件引用的是比 Nop 更新的版本,则 <dependentAssembly> 条目无效。

    【讨论】:

    • 我在 Nop.Web 上安装了 HttpClients,并在 Nop.Web 下的 web.config 中添加了dependentAssembly。现在可以了,谢谢。
    猜你喜欢
    • 2015-07-28
    • 1970-01-01
    • 2015-08-11
    • 2014-07-14
    • 2013-08-24
    • 2020-08-17
    相关资源
    最近更新 更多