Enabling runtime compilation in .Net Core 3

Enabling runtime compilation in .Net Core 3

For those who have been developing web apps using .Net framework, you know for sure how convenient it is to do changes on your razor pages during runtime. It saves time testing designing pages.

But that's not the case for .Net core 3.

Apparently they removed that capability by default due to the cleaning of ASP.Net core shared framework to not depend on Roslyn. But fortunately, we can re-enable that!

Below are the steps:

  1. First, install Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from nuget

    netcoreRntime.png

  2. Lastly, open Startup.cs. And add this line of code inside ConfigureServices services.AddRazorPages().AddRazorRuntimeCompilation();

That's it! You can now see your changes automatically even at runtime.