liveBook · Manning

Runtime compilation

As explained in ASP.NET Core in Action, 3e

Runtime compilation is the process of compiling source or templates while an application is running rather than only during the build.

Runtime compilation compiles Razor Pages while an ASP.NET Core application is running. Developers can change a page and see the result without stopping and rebuilding the application. section 17.1

Use runtime compilation with these practical boundaries:

  • Razor Pages normally compile during the application build and become C# classes behind the scenes. section 17.1
  • Enable runtime compilation when iterating on Razor Pages locally without explicitly stopping and rebuilding. section 17.1
  • Avoid runtime compilation when deploying to production. section 17.1

Editing a Razor Page while the app runs

Start an ASP.NET Core Razor Pages application, modify its Razor template, and reload the page. With runtime compilation enabled, the changed page can be rendered without an explicit stop-and-rebuild cycle. section 17.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines the build-time alternative and runtime behavior, but defers the enablement procedure to external guidance.
Examples
Uses editable Razor Pages and Razor templates as the concrete development examples.
What it assumes
Assumes familiarity with Razor Pages and build-time compilation while introducing runtime compilation as an alternative.
What you can do after
Operate local Razor Page development with changes applied without stopping and rebuilding the application.
How it connects
Connects Razor Pages with Razor, C# classes, and server-side rendering.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.