This is working in ASP.NET Core 2.2, in VS2019.
When you run a project and while project is running, you make a change in view(.cshtml) and go back and refresh the page (while application is running) it used to show the change made.
But is ASP.NET Core 3 I have to run the project again to see changes made in view. To reproduce, if you open a new project and run the project and go to view and make a change and save it. Go back to webpage and refresh it will not be displayed.
This is blocking the development big time. Is there some custom configuration needed with asp.net core 3 or or this a known issue?
This support articel https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0 says that you have to install an extra package and activate the recompilation of views in 3.0.
I think this is changed from 2.2
That did the trick but why would this be removed from the default setup of a project? This seems like one of the very basic requirement? or am i missing something?
Thanks for contacting us, @bhrugen90.
You can read more info regarding the reasons behind moving to this model in the discussion here: https://github.com/aspnet/AspNetCore/issues/7647
I followed the instructions linked here, but when I make changes to razor code in the view, I get a warning (purple squiggle under the code changes)
Changes made in project 'X' will not be applied while the application is running.
Is this a symptom of this bug, or is there something else that needs to be done for runtime Razor code compilation?
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation - 3.0.0-preview7.19365.7
services.AddMvc().AddRazorRuntimeCompilation();
that what worked for me.
@Kolichikov there were bugs in VS 16.3, which in some cases would cause that behavior. Those should be fixed in VS 16.4 release.
Razor file compilation in ASP.NET Core | Microsoft Docs
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0
Razor file compilation in ASP.NET Core | Microsoft Docs
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0
Thank you so much for this @tomexou! After 2 hours of searching around forums and trying a number of "cache-busting" techniques, this is the only answer that I found worked!
Most helpful comment
That did the trick but why would this be removed from the default setup of a project? This seems like one of the very basic requirement? or am i missing something?