Working with Microsoft Visual Studio Community 2019.
I have a project ASP.NET core (but I dont think it is related to core)
When I run the project via IIS Express\project button
When I modify a file (cshtml) "html file" in Core project and click F5/Ctrl+F5 I dont see the changes applied. I need to stop the project and run the project again to see html changes. I understand when modifying the source code I need to rebuild and rerun.
Is there a configuration in VS I need to set so that html changes get reflected when I refresh the page, would save me some much time to see the changes without rebuilding/rerunning?
You can install NuGet Package
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
first, and in ConfigureServices(), add:
services.AddMvc().AddRazorRuntimeCompilation();
then you can just refresh the cshtml to see the changes.
In .Net 8+ Core, there is no ConfigureServices() and instead looks like this:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With