Aspnetcore.docs: Razor file compilation topic updates for 3.0

Created on 3 Oct 2019  Â·  10Comments  Â·  Source: dotnet/AspNetCore.Docs

that was work for me:

services.AddMvc().AddRazorRuntimeCompilation();


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

P1 Source - Docs.ms doc-bug

Most helpful comment

@Legends that is because when you CTRL + F5 the web app with IIS Express, then any change will cause the app to be completely recompiled and restartet, not just recompiling and loading the updated view.

All 10 comments

Ah! Perfect. I was just about to move an issue over to this topic, and your issue here, @lourencocotta, is perfect for it. It pertains to the updates for 3.0.

Looks like some of the annoucement made it in for 3.0 (e.g., the package), but not all of that made its way here (e.g., the extension method). It probably happened because the 3.0 updates to the doc occurred during preview before all of the bits were stabilized in engineering for release.

The file provider scenario discussed on https://github.com/aspnet/AspNetCore.Docs/issues/14593 may apply to these doc updates. I haven't really looked in detail, so idk what applies from that discussion.

I'll ping the readers who were on that discussion so that they can track on the updates and discuss it on this issue: @zhou881117, @nexon33, @alexkyse1.

@nexon33 Feel free to state your solution here. You said something about "the above code" solving it with .AddRazorRuntimeCompilation. I recommend that you add a comment here with whatever worked ... show the code ... it might speed things up a bit.

From @zhou881117 ...

how to run app-parts correct .net core 3.0?

the demo dosen't not work well for .net core 3.0

https://github.com/aspnet/AspNetCore.Docs/tree/5bbb2f5c459cf9bcc1159278a52555cc0f4bb3f6/aspnetcore/mvc/advanced/app-parts

@zhou881117 Good question. I don't know if these are related issues or if that sample breaking is a new issue.

They both pertain to RazorViewEngineOptions changes for 3.0. Even if they are not directly related, they might be worked together because they both pertain to the options changes for Razor for 3.0.

I'll let Rick look because this isn't an area that I specialize in or have very good knowledge of. If Rick wants to work them separately, we'll open a new issue for the App Parts problem from the App Parts topic. Stand-by.

See #14960

When I start my app using StrgCtrl+F5 (VS2019) and edit a view during runtime, it gets compiled after I hit refresh in the browser.

Don't have to add .AddRazorRuntimeCompilation(); at all.
Can you elaborate on this?

When I start my app using Strg+F5 (VS2019)

What's Strg

I think that's German for Ctrl.

[EDIT] Yeah ... I found it ... Steuerung ... for "Control."

Yeah Ctrl ... sorry.

@Legends that is because when you CTRL + F5 the web app with IIS Express, then any change will cause the app to be completely recompiled and restartet, not just recompiling and loading the updated view.

This worked for me for Razor pages:
services.AddRazorPages().AddRazorRuntimeCompilation();

I wanted to avoid turning on Mvc for now, so I was concerned about adding this Nuget package (Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation) since it had Mvc in the name, but it looks like AddRazorPages is built on Mvc APIs and so this is indeed the package I need.

This appears to be fixed,

Was this page helpful?
0 / 5 - 0 ratings