2

Previously, in .NET 9 and lower, we could use RazorRuntimeCompiliation to implement embedded views in assemblies.

services.Configure<MvcRazorRuntimeCompilationOptions>( options =>
 {
     var embeddedFileProvider = new EmbeddedFileProvider( viewAssembly, baseNamespace );
     options.FileProviders.Add( embeddedFileProvider );
 } );

services.AddMvc().AddRazorRuntimeCompilation()
    .AddApplicationPart( viewAssembly );

However, in .NET 10, Razor Runtime Compliation is obsolete. https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/10/razor-runtime-compilation-obsolete.

I am trying to upgrade my app to .NET 10, I am trying to find an alternative to RazorRuntimeCompliation and am not finding a viable alternative. Anyone have any ideas?

2
  • Can you please add a bit more context - why do you want embedded views? Commented Nov 23 at 13:28
  • Embedded Views are a good way to share views from a shared library into multiple web applications. In my use case, I've developed a framework that provides a common user interface layout. This framework is deployed via NuGet and can then be added to a dozen applications. It allows sharing common UI widgets and other functionality to multiple apps. Commented Nov 24 at 17:09

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.