From 3eb9ebd28b260fe112659f7b036e3daf2d38a4df Mon Sep 17 00:00:00 2001 From: Lynn Dai Date: Tue, 12 Mar 2024 11:53:43 -0700 Subject: [PATCH 1/2] add readme for package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation --- .../src/PACKAGE.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md new file mode 100644 index 000000000000..881261fd6834 --- /dev/null +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md @@ -0,0 +1,75 @@ +## About + +Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation is a NuGet package designed to provide runtime compilation support for Razor views in ASP.NET Core MVC applications. This package enables developers to modify and update Razor views without needing to restart the application, facilitating a more dynamic development experience. + +## Key Features + +* Runtime compilation of Razor views in ASP.NET Core MVC applications. +* Allows developers to modify Razor views without restarting the application. +* Supports faster iteration and development cycles. +* Compatible with ASP.NET Core 3.0 and newer. + +## How to Use + +To start using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation in your ASP.NET Core MVC application, follow these steps: + +### Installation + +Install the package via NuGet Package Manager or .NET CLI: + +```sh +dotnet add package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation +``` + +### Configuration + +In your Startup.cs file, configure runtime compilation for Razor views: + +```C# +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; + +public void ConfigureServices(IServiceCollection services) +{ + services.AddControllersWithViews() + .AddRazorRuntimeCompilation(); +} +``` + +### Usage +Now, you can modify Razor views in your application, and the changes will be picked up dynamically without requiring a restart: + +```html + +@{ + ViewData["Title"] = "Home Page"; +} + +

@ViewData["Title"]

+ +

Welcome to the ASP.NET Core MVC application!

+``` + +For more information on using runtime compilation for Razor views in ASP.NET Core MVC, refer to the [official documentation](https://learn.microsoft.com/en-us/aspnet/core/mvc/overview?view=aspnetcore-8.0). + +## Main Types + + + +The main types provided by this library are: + +* `RazorRuntimeCompilationMvcBuilderExtensions`: Extension methods for configuring runtime compilation for Razor views. +* `RazorRuntimeCompilationMvcOptions`: Options for configuring runtime compilation settings. + +## Additional Documentation + + + +* [Overview of ASP.NET Core MVC](https://learn.microsoft.com/en-us/aspnet/core/mvc/overview?view=aspnetcore-8.0) +* [Razor syntax reference for ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-8.0) + +## Feedback & Contributing + + + +Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation is released as open-source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/aspnetcore). \ No newline at end of file From 3006e94685c0f2196ac7dff9092f4d3f420185cd Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Thu, 22 Aug 2024 14:02:16 -0700 Subject: [PATCH 2/2] Update src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md --- src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md index 881261fd6834..0443d0f6fbc6 100644 --- a/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md +++ b/src/Mvc/Mvc.Razor.RuntimeCompilation/src/PACKAGE.md @@ -9,6 +9,14 @@ Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation is a NuGet package designed to * Supports faster iteration and development cycles. * Compatible with ASP.NET Core 3.0 and newer. +## Limitations + +* Isn't supported for Razor components of Blazor apps. +* Doesn't support [global using directives](/dotnet/csharp/whats-new/csharp-10#global-using-directives). +* Doesn't support [implicit using directives](/dotnet/core/tutorials/top-level-templates#implicit-using-directives). +* Disables [.NET Hot Reload](xref:test/hot-reload). +* Is recommended for development, not for production. + ## How to Use To start using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation in your ASP.NET Core MVC application, follow these steps: