Rendering dynamics views in Razor (chtml), How to add a FileProvider to razor in asp.net core 3.0?

前端 未结 2 1757
执念已碎
执念已碎 2021-01-23 18:50

I am migrating from asp-net core 2.2 to asp-net core 3.0, I was using this block to define my File Class Provider, as you know this is used to create dynamic razor views (dynami

2条回答
  •  后悔当初
    2021-01-23 19:22

    For ASP.NET MVC Core 3, this is the way to add a file provider:

    services.AddControllersWithViews()
        .AddRazorRuntimeCompilation(options => options.FileProviders.Add(
            new PhysicalFileProvider(appDirectory)));
    

提交回复
热议问题