Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.cshtml change does not show on page refresh in ASP.NET Core 3 #8856

Closed
bhrugen opened this issue Mar 27, 2019 · 8 comments
Closed

.cshtml change does not show on page refresh in ASP.NET Core 3 #8856

bhrugen opened this issue Mar 27, 2019 · 8 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question

Comments

@bhrugen
Copy link

bhrugen commented Mar 27, 2019

Describe the bug

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?

@FrTerstappen
Copy link

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

@bhrugen
Copy link
Author

bhrugen commented Mar 27, 2019

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?

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 27, 2019
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @bhrugen90.
You can read more info regarding the reasons behind moving to this model in the discussion here: #7647

@Kolichikov
Copy link

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

@lourencocotta
Copy link

services.AddMvc().AddRazorRuntimeCompilation();

that what worked for me.

@mkArtakMSFT
Copy link
Member

@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.

@tomexou
Copy link

tomexou commented Oct 6, 2019

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

@AaronJWinters
Copy link

AaronJWinters commented Oct 21, 2019

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!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question
Projects
None yet
Development

No branches or pull requests

8 participants