을 설명하는 몇 가지 자습서를 읽고을보기 폴더를 이동해야하는 경우보기 폴더의 기본 경로로 바꿉니다. 그러나, 나는 어떻게 보기 엔진에 의해 검색되는 경로를 추가 알아 내려고 노력했습니다. 여기 ASP.NET Core의 검색 위치 추가
내가 지금까지이 작업은 다음과 같습니다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) –