aspnetcore/breaking-changes/10/razor-runtime-compilation-obsolete.md
Razor runtime compilation is obsolete and is not recommended for production scenarios. For production scenarios, use the default build-time compilation. For development scenarios, use Hot Reload instead.
.NET 10 Preview 7
Previously, you could use Razor runtime compilation to recompile .cshtml files while the application was running. This meant you didn't need to restart the application for changes to take effect.
Starting in .NET 10, use of the affected APIs produces a compiler warning with diagnostic ID ASPDEPR003:
warning ASPDEPR003: Razor runtime compilation is obsolete and is not recommended for production scenarios. For production scenarios, use the default build time compilation. For development scenarios, use Hot Reload instead. For more information, visit https://aka.ms/aspnet/deprecate/003.
This change can affect source compatibility.
Razor runtime compilation has been replaced by Hot Reload, which has been the recommended approach for a few years now. This change makes it clearer that Razor runtime compilation doesn't get support for new features and should no longer be used.
Remove calls to xref:Microsoft.Extensions.DependencyInjection.RazorRuntimeCompilationMvcBuilderExtensions.AddRazorRuntimeCompilation%2A and use Hot Reload instead.