Skip to content

Breaking changes to runtime compilation for Razor views and Razor Pages #343

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

Open
pranavkm opened this issue Feb 16, 2019 · 0 comments
Open
Labels
3.0.0 Announcements related to ASP.NET Core 3.0 Announcement Breaking change Documented The breaking change has been published to the .NET Core docs Migrated
Milestone

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Feb 16, 2019

As a consequence of cleaning up the ASP.NET Core shared framework to not depend on Roslyn, support for runtime compilation of Razor views and Razor Pages is being moved to a separate package.
Applications that require runtime compilation or re-compilation of Razor files should

  • Add a reference to the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package
  • Update the application's ConfigureServices to include a call to AddMvcRazorRuntimeCompilation:
services.AddMvc()
    .AddMvcRazorRuntimeCompilation();

The following APIs previously available on Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions to support runtime compilation would now be available via
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.MvcRazorRuntimeCompilationOptions:

  • RazorViewEngineOptions.FileProviders -> MvcRazorRuntimeCompilationOptions.FileProviders
  • RazorViewEngineOptions.AdditionalCompilationReferences -> MvcRazorRuntimeCompilationOptions.AdditionalReferencePaths

In addition, Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions.AllowRecompilingViewsOnFileChange has been removed. Recompilation on file changes is enabled by default by referencing the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package.

Related issues: #312, #325

Please use dotnet/aspnetcore#7647 for further discussions or questions.

This announcement has been migrated to dotnet/docs#14925

@pranavkm pranavkm added Announcement Breaking change 3.0.0 Announcements related to ASP.NET Core 3.0 labels Feb 16, 2019
@pranavkm pranavkm added this to the 3.0.0 milestone Feb 16, 2019
@aspnet aspnet locked as spam and limited conversation to collaborators Feb 16, 2019
@scottaddie scottaddie added the Documented The breaking change has been published to the .NET Core docs label Dec 17, 2019
rafa-ce referenced this issue in rafa-ce/AutomobileServiceCenter.Core Apr 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.0.0 Announcements related to ASP.NET Core 3.0 Announcement Breaking change Documented The breaking change has been published to the .NET Core docs Migrated
Projects
None yet
Development

No branches or pull requests

4 participants