【问题标题】:Method not found: 'System.Collections.Generic.IList`1<Nop.Services.Cms.IWidgetPlugin>找不到方法:'System.Collections.Generic.IList`1<Nop.Services.Cms.IWidgetPlugin>
【发布时间】:2014-02-15 17:36:46
【问题描述】:

我已经编译了我的 nopcommerce 解决方案,但现在出现了这个错误:

找不到方法:'System.Collections.Generic.IList`1 Nop.Services.Cms.IWidgetService.LoadActiveWidgetsByWidgetZone(System.String)'。

它中断的代码是:

 public static MvcHtmlString Widget(this HtmlHelper helper, string widgetZone)
        {
            return helper.Action("WidgetsByZone", "Widget", new { widgetZone = widgetZone });
        }

这是什么意思?它说的方法不存在在这里:

[ChildActionOnly]
        public ActionResult WidgetsByZone(string widgetZone)
        {
            //model
            var model = new List<RenderWidgetModel>();

            //var widgets = _widgetService.LoadActiveWidgetsByWidgetZone(widgetZone);
            var widgets = _widgetService.LoadActiveWidgetsByWidgetZone(widgetZone, _storeContext.CurrentStore.Id);
            foreach (var widget in widgets)
            {
                var widgetModel = new RenderWidgetModel();

                string actionName;
                string controllerName;
                RouteValueDictionary routeValues;
                widget.GetDisplayWidgetRoute(widgetZone, out actionName, out controllerName, out routeValues);
                widgetModel.ActionName = actionName;
                widgetModel.ControllerName = controllerName;
                widgetModel.RouteValues = routeValues;

                model.Add(widgetModel);
            }

            return PartialView(model);
        }

还值得注意的是,清洁和构建的解决方案可以正常工作并且代码运行良好,如果您停止然后再次运行它会中断,

【问题讨论】:

  • 你能显示一些代码吗?
  • 如果您针对错误的 DLL 版本运行,就会发生这种情况。
  • @SLaks 我检查了 DLL 版本,它是正确的
  • @Jason 为问题添加了代码
  • 如果一个干净的构建使其工作正常,那么当您只是进行常规构建时,您正在处理依赖 dll 没有进入输出目录。

标签: c# asp.net e-commerce nopcommerce


【解决方案1】:

在这种情况下,您通常需要手动删除以下内容(通过 Windows 资源管理器):

  1. 演示文稿\Nop.Web\bin
  2. 演示文稿\Nop.Web\obj
  3. 演示文稿\Nop.Web\插件

然后在 Visual Studio 中进行重建。

【讨论】:

  • 没问题的朋友。 :)
猜你喜欢
  • 2017-07-05
  • 1970-01-01
  • 2020-11-25
  • 1970-01-01
  • 2019-07-26
  • 1970-01-01
  • 2021-10-31
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多