Welcome to the navigation

Dolore adipisicing quis eu laboris velit pariatur, sed aliqua, officia enim consequat, et lorem est anim minim cillum qui sunt elit, veniam, esse dolor sit. Aliqua, aliquip ullamco dolore minim est commodo sint sunt nulla officia ad dolor mollit in eu veniam, sed in laborum, in velit consectetur tempor excepteur

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