ASP.NET MVC Core 3.1应用程序中CSHTML更改和JS更改所需的内部版本 [英] Build required for CSHTML changes, JS changes in ASP.NET MVC Core 3.1 Applications

查看:597
本文介绍了ASP.NET MVC Core 3.1应用程序中CSHTML更改和JS更改所需的内部版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将我的 ASP.NET MVC Core 2.2应用程序升级到Core 3.1 ,一切正常,但是在调试会话中,如果我对CSHTML文件进行了任何更改(例如添加新的HTML)标记或更改JS文件中的代码,它不会通过在本地调试会话上刷新应用程序反映出来.我将不得不停止我的VS,然后重新构建并在调试模式下运行.

I have recently upgraded my ASP.NET MVC Core 2.2 application to Core 3.1, everything works well, but in debug sessions if I make any changes to CSHTML file, like adding a new HTML tag or change code in JS file, it doesn't reflect by refreshing the app on localhost debug session. I will have to stop my VS and re-build and run in debug mode.

这仅在我拥有的其他项目中针对ASP.NET Core 3.1发生 使用ASP.NET Core 2.2进行任何CSHTML更改,我都无需重建 解决方案.

This is happening only for ASP.NET Core 3.1 in other projects I have with ASP.NET Core 2.2 for any CSHTML changes I don't have to rebuild the solution.

我正在使用Microsoft Visual Studio Enterprise 2019 Version 16.4.1

任何帮助将不胜感激.

Any help is greatly appreciated.

推荐答案

在SO上找到答案:安装NuGetpackage Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

使用

services.AddControllersWithViews(x=>x.SuppressAsyncSuffixInActionNames = false)
.AddRazorRuntimeCompilation();

这篇关于ASP.NET MVC Core 3.1应用程序中CSHTML更改和JS更改所需的内部版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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