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

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

Open
pranavkm opened this Issue Feb 16, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@pranavkm
Copy link
Member

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 aspnet/AspNetCore#7647 for further discussions or questions.

@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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.