VS2019 中 .Net Core 3.1 项目默认没有启用动态编译,

这导致按F5调试的时候,修改了 HTML 代码,在浏览器上刷新没有效果。

启用动态编译方法如下:

1. 安装 Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet 包

2. 在 Startup.cs 文件的 ConfigureServices 方法添加 AddRazorRuntimeCompilation

services
    .AddControllersWithViews()
    // 动态编译
    .AddRazorRuntimeCompilation();

 

经过以上两步配置,按F5调试的时候,修改了 HTML 代码,在浏览器上刷新就能看到修改后效果了。

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-22
  • 2022-01-13
  • 2020-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
相关资源
相似解决方案