Welcome to the navigation

Nisi nulla laborum, laboris exercitation irure est lorem in consequat, adipisicing culpa non dolor eiusmod excepteur aliqua, consectetur dolor fugiat eu pariatur, amet, dolore qui. Cillum nisi amet, culpa do in quis et excepteur ut ad ut anim minim pariatur, laboris nostrud aute dolor laborum, id aliquip fugiat ex reprehenderit

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

Please note that this portal is a BETA site , I will continuously improve all functionality and performance during the coming weeks / the author