Under normal circumstances, the view at the time of generation will become xxx.Views.dll, during development, this is very easy, because a lot of the time, we just modify a style, adjust some JavaScript code, this time should project commissioning paused, looking at page after generating effect.
First by nuget console installation package:
Install-Package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation -Version 3.0.0
Then Startup.cs file, adding ConfigureServices function:
.AddRazorRuntimeCompilation() //如下 services.AddMvc() .AddRazorRuntimeCompilation() .AddNewtonsoftJson() .SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0);
Finally add (VS2019 double-click the project) in the project file:
Note: Do not perform the following operations can also be run compile, but when you publish Views directory will be compiled as *** Views.dll file.
<RazorCompileOnBuild>false</RazorCompileOnBuild> <RazorCompileOnPublish>false</RazorCompileOnPublish>
After the clean-up solution can recompile.
Note: only modify XML project files increase, it will complain when debugging, prior to the need for a two-step operation.
Official: https://docs.microsoft.com/zh-cn/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0