升级 .net 6后 The view 'Index' was not found. The following locations were searched

升级.net6之后Razor页面出现找不到view的情况,原因是.net6默认移除了一些依赖包,如下完美解决
web工程添加包
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
startup.cs里面加上Compilation引用
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();

 

posted on 2023-04-19 15:23  晴天的故事  阅读(609)  评论(0编辑  收藏  举报