[英]Load Razor cshtml pages at runtime in DotNet Core
I would like to be able to drop in Razor based "Theme" _Layout.cshtml files at runtime in my current project, however I cannot find a way to tell the project not to pre-compile these files AND allow new files to be added (or existing files updated). 我希望能够在当前项目的运行时放入基于Razor的“ Theme” _Layout.cshtml文件,但是我无法找到一种方法来告诉项目不要预编译这些文件并允许添加新文件(或现有文件已更新)。
I have found, through the project settings to tell the project NOT to precompile views on Publish, which requires me to add the .cshtml files into the published package, but if they are updated at runtime, it requires a restart of the app for the changes to be noticed. 我发现通过项目设置告诉项目不要在Publish上预编译视图,这要求我将.cshtml文件添加到已发布的程序包中,但是如果它们在运行时更新,则需要重新启动应用程序才能使用发生变化。
Is this possible ? 这可能吗 ?
On the top of your .chtml page you will find that @layout =your layout page name. 在.chtml页面的顶部,您会发现@layout =您的布局页面名称。 Just remove the name and put null instead of that. 只需删除名称,然后输入null即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.