External razor views can't see external models

蓝咒 提交于 2019-12-02 12:10:25

Try use the using directive in your Views in the dynamic assembly.

@using MyNamespace.MyPlugin.Models;
@using MyNamespace.MyPlugin;

etc

I was able to precompile views with RazorGenerator Visual Studio extension (not RazorGenerator.Mvc one) in my assemblies.

It basically converts .cshtml razor views into .cs files with WebViewPage classes before assemblies compile. And in my web project I had to implement my own VirtualPathProviderViewEngine similar to this one

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!