An example project that shows how to render a razor view and optional controller to a string.
This repo contains the standard ASP.NET Core MVC project template, modified to support rendering the HomeController.Index
route to a string from the command line.
Unlike other solutions available on the web, this solution does not require an HttpContext, making it suitable for scenarios like command line applications.
This is based heavily off of RazorViewToStringRenderer, however that proof-of-concept is out of date and no longer works.