ASP.NET Core cannot find cshtml file by path using RazorViewEngine
问题 I want to find my cshtml file in my ASP.NET Core 2.1 Web API project. To do it, I'm using this code: var httpContext = new DefaultHttpContext { RequestServices = this.serviceProvider }; var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor()); var viewResult = this.razorViewEngine.FindView( actionContext, "~/PdfTemplate/ProjectRaport.cshtml", false); The file is here: But from code above, the View (that is ~/PdfTemplate/ProjectRaport.cshtml ) is null. How to