Welcome to the navigation

Incididunt aute pariatur, quis in minim sunt sit laborum, ex nulla commodo mollit eu duis consectetur reprehenderit esse sed enim ut aliquip officia ut dolor. Sunt consectetur quis ut sit proident, commodo adipisicing aliqua, magna cupidatat velit culpa voluptate enim nostrud dolore excepteur id laboris in consequat, mollit in et

Yeah, this will be replaced... But please enjoy the search!

Episerver 10 upgrade error, The following file could not be rendered because its extension ".cshtml"

I upgraded a site to Episerver 10 which gave me an error "The following file could not be rendered because its extension ".cshtml" might not be supported".

The following file could not be rendered because its extension ".cshtml" might not be supported: "~/Views/Shared/_Layout.cshtml".

Exception Details: 
System.Web.HttpException: The following file could not be rendered because its extension ".cshtml" might not be supported: "~/Views/Shared/_Layout.cshtml".

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[HttpException (0x80004005): The following file could not be rendered because its extension ".cshtml" might not be supported: "~/Views/Shared/_Layout.cshtml".]
   System.Web.WebPages.BuildManagerExceptionUtil.ThrowIfUnsupportedExtension(String virtualPath, HttpException e) +176
   System.Web.WebPages.WebPageBase.CreatePageFromVirtualPath(String virtualPath, HttpContextBase httpContext, Func`2 virtualPathExists, DisplayModeProvider displayModeProvider, IDisplayMode displayMode) +358
   System.Web.WebPages.<>c__DisplayClass3.b__2(TextWriter writer) +254
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +108
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +89
   ...

The solution is to clear the .net cache

Close all Visual Studio instances and run the following script in an elevated PowerShell window

net stop w3svc
Remove-Item -Path "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\*" -Force -Recurse
Remove-Item -Path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\*" -Force -Recurse
net start w3svc

This may not work the first time, and some folders may throw a lot of errors, try again and if that doesn't work restart the computer and run the script again directly when Windows booted.

Let me know of your results