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...
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With