asp.net core 3.0 Debug not restart automatically when recompiled View

After .net core3.0, when debug, if modified View (cshtml), default not refresh the page will take effect immediately, need to stop and re-start the project before they can. There is no doubt this is very troublesome.

 

Solution

First install Nuget package:

Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

  

Startup then added in the following fragment ConfigureServices in:

public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext<ApplicationDbContext>(options =>
    {
        options.UseSqlite("Data source=calendar.db");
    });
 
    services.AddControllersWithViews()
            .AddRazorRuntimeCompilation();
 
}

At this point, you're done!

Guess you like

Origin www.cnblogs.com/zhurongbo/p/12055409.html
Recommended