Posted by Anuraj on Friday, August 28, 2015 Reading time :1 minute
This post is about implementing Custom View Engine in ASP.NET 5. Normally ASP.NET MVC looks for view files (*.cshtml), inside Views/Controller folder. If you want to configure it to some other location, you can manage it via custom view engine. Here is the implementation.
This implementation is different than custom view engine implementation in previous versions of ASP.NET MVC. In ASP.NET MVC 5 or previous, ViewLocationFormats added in the constructor, but it is not possible, since ViewLocationFormats property is readonly.
Here is the modified folder structure include UI folder.
You can configure this view engine in the Startup.cs, ConfigureServices() method.
This code is clearing the existing view engines and adding the new custom view engine.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.