Skip to content

Embedded Views in ASP.NET Core 10 #64715

@starcatatctc

Description

@starcatatctc

Previously, in .NET 9 and lower, we could use RazorRuntimeCompilation 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 Compilation 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 RazorRuntimeCompilation that allows me to keep the same functionality, and am not finding a viable alternative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions