I'm testing the new Razor Components (aka. Server Side Blazor) and I'm finding the need to stop the project, edit, recompile and restart the server, very time consuming. I want to edit the *.razor files, save, press F5 on the browser, and done.
I know there is a breaking change on ASP.NET Core 3, that prevented this from happening for a while. But now, there is a "fix": you just need to install the package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
, and setup the service like that:
services.AddMvc()
.AddRazorRuntimeCompilation();
(Yes, without Mvc, see this)
But that does not seems to work - at least, I did not try with cshtml files, since I am only using *.razor in my tests.
I also did:
services.AddMvc()
.AddRazorRuntimeCompilation((options) =>
{
foreach (var item in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.razor", SearchOption.AllDirectories))
{
options.AdditionalReferencePaths.Add(item);
}
});
Without any luck.
Is this not yet supported or I am doing something wrong?