Welcome to the navigation

Exercitation adipisicing do velit mollit nulla enim aute ut dolore proident, sunt elit, qui labore dolore minim ex aliqua, fugiat nisi deserunt magna esse laboris. Dolore ipsum non et fugiat esse enim consequat, reprehenderit eu qui ut labore ut deserunt ullamco in dolor aute irure nisi pariatur, do commodo id

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