Browse Source

Add manual Razor Runtime Compilation guidance

pull/23788/head
maliming 8 months ago
parent
commit
dcda36353e
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 22
      docs/en/release-info/migration-guides/abp-10-0.md

22
docs/en/release-info/migration-guides/abp-10-0.md

@ -10,7 +10,27 @@ We've upgraded ABP to .NET 10.0, so you need to move your solutions to .NET 10.0
### Razor Runtime Compilation Obsolete
We removed the Razor Runtime Compilation support.
We removed the Razor Runtime Compilation support since it is obsolete and replaced by [Hot Reload](https://learn.microsoft.com/en-us/aspnet/core/test/hot-reload) in .NET 10.0.
If you want to keep using it, you can add [Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation](https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation) package to your project and configure it manually.
```csharp
public override void ConfigureServices(ServiceConfigurationContext context)
{
if (context.Services.GetHostingEnvironment().IsDevelopment())
{
var mvcCoreBuilder = context.Services.AddMvc();
mvcCoreBuilder.AddRazorRuntimeCompilation().Services
#pragma warning disable ASPDEPR003
.Configure<MvcRazorRuntimeCompilationOptions>(options =>
#pragma warning restore ASPDEPR003
{
options.FileProviders.Add(new RazorViewEngineVirtualFileProvider(mvcCoreBuilder.Services
.GetSingletonInstance<IObjectAccessor<IServiceProvider>>()));
});
}
}
```
For more information, you can check the [Razor Runtime Compilation Obsolete](https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/10/razor-runtime-compilation-obsolete) page.

Loading…
Cancel
Save