I created a brand new web app in VS2022 using the "ASP.Net Core Web App (Model-View-Controller)" Template in .Net 6
I ran the application and got this error:
InvalidOperationException: The view 'Index' was not found.
I haven't changed any of the template code.
Very strange...
CodePudding user response:
I've found one way to get it working...although its not clear to me why this works:
Add this package Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
and then change services.AddControllersWithViews()
in Program.cs
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();