In my NET Framework 4.x ASP MVC projects, when using the IDE, it was possible to edit a .cshtml View, then save, then press ctrl+F5 in the browser and see the actual change.

It seems to be not working in .NET Core (using VS 2019 and .NET Core 3 Preview 5)


Is this feature missing in .NET Core or is this a preview issue, or am I missing something?

2 Answers

Kirk Larkin On Best Solutions

This is something that is no longer enabled by default with ASP.NET Core 3, but can be re-enabled as documented here:

Runtime compilation is enabled using the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package. To enable runtime compilation, apps must:

g.pickardou On

I've marked Kirk's answer as accepted, but maybe this experience could be useful also.

My goal was a "quick edit (cshtml/css/js/ts) then see" iteration.

No need to add and mod anything... I discovered that .NET Core (3) and VS 2019 is so much faster, so in case if we do not want to debug in VS (which is the scenario in most cases when we are changing cshtml/css/js/ts) there is really great iteration:

  1. Press ctrl+f5 to launch your web app (no debug) in browser
  2. See, test (debug js/ts in Chrome)
  3. Edit your cshtml/css/js/ts
  4. Press ctrl+shift+b to build (fast!)
  5. Switch to your browser and press ctrl+f5 to refresh your page (fast!)
  6. Goto 2