Changing HTML does not reflect on page - Asp . NET Core 3.0

Asked

Viewed 1,049 times

4

I recently decided to test the ASP .Net core 3.0, I always changed HTML without the need to recompile the project, but in this version, I can’t change anything in HTML without the need to recompile the entire project, even a simple tag. I didn’t find anything in the documentation about this change, whether it’s some configuration, or some error in the IDE itself, which had to be updated, before I used the Visual Studio 2017, and in version . Net Core 3.0, requires Visual Studio 2019.

Would there be any way to change this? Because it is very inconvenient to have to recompile to apply a simple HTML change.

4 answers

3


You need to install the bundle Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation via nuget and then configure the service AddRazorRuntimeCompilation in the startup.Cs.

public void ConfigureServices(IServiceCollection services)
{
    services.AddControllersWithViews().AddRazorRuntimeCompilation();
}
  • I was having the same problem using . net 3.1 and VS 2019. I did what you said and it seems to have solved.

2

This is an option from the Visual Studio IDE, not a language feature.

To enable go follow the steps:

  1. Open the menu Tools > Options (en: Tool / Options)

  2. Click on the option Debugging (en: Debugging)

  3. Find the option Enable Edit and Continue (en: Enable Edit and Carry on) and the daughters option, as shown below.

inserir a descrição da imagem aqui

2

The same thing happens to me. My Visual Studio 2019 has these options enabled and nothing.

One solution I found was: With the view you want to edit open.

File > View in Browser

or by shortcut shortcut: CTRL+SHIFT+W

I edited CSS and HTML and it worked smoothly, I did not test with JS.

1

To resolve this, edit your project file .CSPROJ, adding the tag Razorcompileonpublish and marked with "false":

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.