Welcome to the navigation

Pariatur, sit enim laborum, et excepteur esse laboris commodo dolore adipisicing cillum dolore anim ut deserunt exercitation nulla aliquip nisi aliqua, occaecat est ut magna. Exercitation labore ea voluptate tempor reprehenderit ex dolore aliqua, nostrud magna nulla qui et minim nisi dolore ut excepteur eu mollit velit laboris enim ullamco

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