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

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

启用动态编译方法如下:

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

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

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

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

相关文章:

  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-06-12
猜你喜欢
  • 2021-05-28
  • 2021-12-03
  • 2021-04-11
  • 2021-11-26
  • 2022-12-23
相关资源
相似解决方案