Fix Error - InvalidOperationException: The view 'Index' was not found. The following locations were searched: /Views/StartPage/Index.cshtml
Issue
If you install a fresh instance of CMS 12 and if you build a solution with Visual Studio, the site breaks with The view 'Index' was not found error. It appears like the below screenshot.
Fix
Delete your /bin and /obj folder
Now instead of building a solution from Visual Studio, Open the console OR terminal at the root of the Website and run
dotnet run
The above command will compile your code cleanly without the above issue
I don't know what Visual Studio "Build Solution" vs "dotnet run" does differently which causes this, but this fixes the issue if anyone is looking to resolve it.
Subscribe to my newsletter
Read articles from Vaibhao Chawale directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Vaibhao Chawale
Vaibhao Chawale
I am a Solutions Architect and Certified Subject Matter Expert in Optimizely Configured Commerce. With expertise in Optimizely Products, Umbraco, and Sitecore CMS.