Skip to main content

Microsoft

Sitecore 8.2 Upgrade – View Rendering Gotcha

When upgrading to Sitecore 8.2, watch out for this issue that we ran into. If you have any View Renderings that don’t end in “.cshtml”, like for example you had an extra space at the end of one of them and it ended in “.cshtml “, you may have a problem. Sitecore, in an effort to be helpful I am sure, will add “.cshtml” to the end of your rendering path if it isn’t already there (I’m guessing someone forgot a .Trim()). If you have an extra space like we did, however, your renderings will break and you will see this:

sitecore8_2_view_rendering

System.InvalidOperationException: The partial view ‘/Views/Area/Widget.cshtml .cshtml’ was not found or no view engine supports the searched locations. The following locations were searched: /Views/Area/Widget.cshtml .cshtml


In order to fix it, just update the path to remove the extra space at the end. In an effort to be helpful myself, I’m including a Sitecore PowerShell command that will help you find the list of offending view renderings. Packaging this command into a fire-and-forget script can be an exercise for the reader. 🙂

(Get-Item /sitecore/layout -Query "/sitecore/layout/renderings//*[@@templatename='View rendering']") | where-object {$_.Path -match ".cshtml " }

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Matt Connolly

More from this Author

Categories
Follow Us