Question: How do you solve for the error in AspNet 6 MVC "An unhandled exception occurred while processing the request "The view 'ViewName' was not found. The following locations were searched".
This error seems to be not correct, there is a View with the View Name in the directory. Why can't Visual Studio 2022 find the View? I can see it.
Answer: Absolutely, the Compiler is correct, the View cannot be found, take a clear look at the View in question. You will find out that it has a subclass nested.
At some point when you copied and pasted the same View in order to create a new one, the Compiler or the Microsoft Build Engine ended up changing one View to be more like a Razor Page.
This is most likely to happen when you copy and paste the same View and you notice no errors even when the Views have the same names. The reason why the MS Build or the IntelliSense did not throw an error even when the Views seem to have the same is, one of the Views got changed.