How to fix Page Not Refreshing After Changes
By FoxLearn 2/18/2024 9:33:35 AM 121
This post shows you How to fix .NET Core MVC Page Not Refreshing After Changes.
asp.net core live reload
By default, If you are not only explicit in the 'Development' environment then the Razor View is compiled and you will not see any changes made to .cshtml file.
cshtml changes not showing
In ASP.NET Core 2.2 you can add a configuration to your Startup class as shown below.
services.AddMvc().AddRazorOptions(options => options.AllowRecompilingViewsOnFileChange = true);
But, In ASP.NET Core 3.0 you should install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from Manage Nuget Packages, then add a configuration to your Startup class as shown below.
services.AddControllersWithViews().AddRazorRuntimeCompilation();
Another way to separate project
if(HostingEnvironment.IsDevelopment()){ services.AddMvc().AddRazorOptions(o => { o.FileProviders.Add(new PhysicalFileProvider(PATH_TO_PROJECT)); }); }
Through this c# example, i hope so you can fix ASP.NET Razor views are not updating when simply updating html or asp.net mvc view not updated if only .cshtml changed.
- How to Minify HTML using WebMarkupMin in ASP.NET Core
- How to fix 'IMvcBuilder' does not contain a definition for 'AddNewtonsoftJson'
- How to fix System.InvalidOperationException: Scheme already exists: Identity.Application
- The name 'Session' does not exist in the current context
- How to fix 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer'
- How to fix Using 'UseMvc' to configure MVC is not supported while using Endpoint Routing
- How to Increase upload file size in ASP.NET Core
- How to fix LoginPath not working in ASP.NET Core
Categories
Popular Posts
C# Tutorial
07/20/2024
How to Download Microsoft SQL Server
06/22/2024
What Are RESTful Web Services?
02/19/2024