in beta6 we were able to plugin a custom viewengine like this:
services.AddMvc()
.AddViewOptions(options =>
{
options.ViewEngines.Clear();
options.ViewEngines.Add(typeof(MyCustomViewEngine));
});
this no longer works in beta7 and options.ViewEngines seems to have changed to an
IList<IViewEngine>
I don't understand how to plug one in without having to new it up and provide its dependencies
options.ViewEngines.Add(new it up here?);
How can I plug in my own custom viewengine in beta7?
I figured it out, before calling
services.AddMvc()
I need to add my viewengine to DI
services.TryAddSingleton<IRazorViewEngine, MyCustomViewEngine>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With