【发布时间】: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