AspNet Core 3.0和3.1:启用Razor页面的运行时编译 [英] AspNet Core 3.0 and 3.1 : Enable runtime compilation for Razor Pages

查看:846
本文介绍了AspNet Core 3.0和3.1:启用Razor页面的运行时编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自ASP.Net Core 3.0版和更高版本开始:

Since ASP.Net Core version 3.0 and higher:

A)运行应用程序时编辑Razor View(.cshtml)文件在重新启动之前不会应用更改.

A) Editing a Razor View (.cshtml) file while running the application does not apply the changes until restart.

B)似乎编辑和继续操作不起作用.

B) Looks like edit and continue is not working.

IDE和版本: Microsoft Visual Studio 2019

IDE and Version: Microsoft Visual Studio 2019

推荐答案

对于此问题,建议您尝试安装软件包Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation,然后像在

For this issue, I suggest you try to install package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation and then configure AddRazorRuntimeCompilation in Startup.cs like

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllersWithViews().AddRazorRuntimeCompilation();
}

对于此问题,您可以通过对Razor视图和Razor页面的运行时编译进行重大更改,以进行跟踪. 343

For this issue, you could trace by Breaking changes to runtime compilation for Razor views and Razor Pages #343

这篇关于AspNet Core 3.0和3.1:启用Razor页面的运行时编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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