嵌入式剃刀视图 [英] Embedded razor views

查看:37
本文介绍了嵌入式剃刀视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我读了一篇post 在这里,作者描述了我们如何将 razor 视图编译到单独的库中.我想问一下,是否可以在不编译的情况下将视图嵌入到库中?然后,添加自定义 VirtualPathProvider 以读取视图.

Recently, I read a post where the author describes how we can compile razor views into separate libraries. I would like to ask, is it possible to embed views in libraries without compiling? And then, add custom VirtualPathProvider to read the views.

推荐答案

你可以使用我的 EmbeddedResourceVirtualPathProvider可以通过 Nuget 安装.它从引用的程序集中加载资源,还可以设置为在开发过程中依赖源文件,以便您无需重新编译即可更新视图.

You can use my EmbeddedResourceVirtualPathProvider which can be installed via Nuget. It loads resources from referenced assemblies, and also can be set to take dependencies on the source files during development so you can update views without needing a recompile.

这篇关于嵌入式剃刀视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆