Fix Error - InvalidOperationException: The view 'Index' was not found. The following locations were searched: /Views/StartPage/Index.cshtml

Optimizely/EPiServer CMS 12 - Starting Website Fix

Table of contents

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.