を説明するいくつかのチュートリアルを読んで、を、ビューフォルダを移動する必要がある場合のビューフォルダのデフォルトパスに置き換えます。しかし、私はどのようにビューエンジンで検索されるパスを追加する方法を把握しようとしています。ASP.NET CoreのViewEngineExpanderで検索場所を追加する
は、ここで私がこれまで持っているものです。
public class BetterViewEngine : IViewLocationExpander
{
public void PopulateValues(ViewLocationExpanderContext context)
{
}
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
{
return viewLocations.Select(s => s.Add("")); //Formerly s.Replace("oldPath", "newPath" but I wish to add
}
}
そして、私のStartup.cs
services.AddMvc().AddRazorOptions(options =>
{
options.ViewLocationExpanders.Add(new BetterViewEngine());
});
を変更したいですビューのデフォルトの場所? –
このポストを参照してください:[ASP.NET MVCでビューを検索するカスタムの場所を指定できます](http://stackoverflow.com/questions/632964/can-i-specify-a-custom-location-to -search-for-views-in-asp-net-mvc) –