Is live reload with in-process aspnet core 3 possible?

I was very happy to implement Westwind.AspnetCore.LiveReload per this blog post. It was quite easy and worked better than BrowserSync.


As far as I know, the runtime compilation could just work in the develop environment. That means you couldn't use it in the production environment(which is hosted on the IIS).

If you change the visual studio's debug environment to IIS, it will stil work.

Besides, RuntimeCompilation is not a build-in feature in the asp.net core 3.0.

If you want to use it, I suggest you could try to install the package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation and then configure AddRazorRuntimeCompilation in Startup.cs like

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllersWithViews().AddRazorRuntimeCompilation();
}

There is a new way of doing this for 3.1, taken from: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.1

Add the package at csproj

<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.3" />

Then at launch.json, add a new environment variable

"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"