Forum Discussion
Hammad_ul_haq
Feb 16, 2024Copper Contributor
.NET 8.0.2 Update Causes ASP.NET Core MVC 'Index View Not Found' Error
Hello everyone, I recently updated to .NET https://github.com/dotnet/core/blob/main/release-notes/8.0/8.0.2/8.0.2.md?WT.mc_id=dotnet-35129-website and encountered an issue with my ASP.NET Core MV...
abusufyan_14
Feb 19, 2024Copper Contributor
Hammad_ul_haq I'm also facing the same problem even when I have created fresh projects all projects give me the same error.
I found a solution was installing the Nuget Package "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" and then in my Program.cs I appended builder.Services.AddControllersWithViews() with. AddRazorRuntimeCompilation() so it looks like "builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();"
But it should be a proper fix from Microsoft in this version instead of doing some manual work especially when we create a fresh new project.
LeoStefano
May 01, 2024Copper Contributor
Thanks a lot, worked for me.
Add Nuget package
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.4" />
and at program.cs:
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
Add Nuget package
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.4" />
and at program.cs:
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
- DavideBelloneJun 11, 2024Copper ContributorHave you also replaced
app.MapRazorPages();
with something else?