我正在尝试实现一个IViewLocationExpander来为我的MVC应用程序添加视图路径,但是我找不到IViewLocationExpander,我无法弄清楚我应该添加什么参考。我的目标框架是4.5.1。 ASP.NET MVC nuget包已添加到项目中。如果我需要升级到.Net框架或MVC包的更新版本,那很好,但我不想在黑暗中刺伤。这是我的课程,无法编译:
public class AreaViewLocationExpander : IViewLocationExpander
{
public void PopulateValues(ViewLocationExpanderContext context) { }
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
{
return new[]
{
"/AnotherPath/Views/{1}/{0}.cshtml",
"/AnotherPath/Views/Shared/{0}.cshtml"
}; // add `.Union(viewLocations)` to add default locations
}
}